1
0
mirror of https://github.com/badges/shields.git synced 2025-04-20 06:47:51 +03:00
shields/services/codeclimate/codeclimate-coverage.tester.js
2020-04-19 17:06:35 +02:00

37 lines
1004 B
JavaScript

'use strict'
const Joi = require('@hapi/joi')
const { isIntegerPercentage } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
// Examples for this service can be found through the explore page:
// https://codeclimate.com/explore
t.create('test coverage percentage')
.get('/coverage/codeclimate/minidoc.json')
.expectBadge({
label: 'coverage',
message: isIntegerPercentage,
})
t.create('test coverage letter')
.get('/coverage-letter/codeclimate/minidoc.json')
.expectBadge({
label: 'coverage',
message: Joi.equal('A', 'B', 'C', 'D', 'E', 'F'),
})
t.create('test coverage percentage for non-existent repo')
.get('/coverage/unknown/unknown.json')
.expectBadge({
label: 'coverage',
message: 'repo not found',
})
t.create('test coverage percentage for repo without test reports')
.get('/coverage/angular/angular.js.json')
.expectBadge({
label: 'coverage',
message: 'test report not found',
})