Split up [codeclimate] tests (#3300)

* Split up [codeclimate] tests

* Fix copy-pasta
This commit is contained in:
Paul Melnikow
2019-04-13 19:47:59 -04:00
committed by Caleb Cartwright
parent d343fddb2c
commit 11cd0bdbc5
2 changed files with 55 additions and 45 deletions

View File

@@ -0,0 +1,53 @@
'use strict'
const Joi = require('joi')
const { ServiceTester } = require('../tester')
const { isIntegerPercentage } = require('../test-validators')
const t = (module.exports = new ServiceTester({
id: 'CodeClimateCoverage',
title: 'Code Climate',
pathPrefix: '/codeclimate',
}))
t.create('test coverage percentage')
.get('/c/jekyll/jekyll.json')
.expectBadge({
label: 'coverage',
message: isIntegerPercentage,
})
t.create('test coverage percentage alternative coverage URL')
.get('/coverage/jekyll/jekyll.json')
.expectBadge({
label: 'coverage',
message: isIntegerPercentage,
})
t.create('test coverage percentage alternative top-level URL')
.get('/jekyll/jekyll.json')
.expectBadge({
label: 'coverage',
message: isIntegerPercentage,
})
t.create('test coverage letter')
.get('/c-letter/jekyll/jekyll.json')
.expectBadge({
label: 'coverage',
message: Joi.equal('A', 'B', 'C', 'D', 'E', 'F'),
})
t.create('test coverage percentage for non-existent repo')
.get('/c/unknown/unknown.json')
.expectBadge({
label: 'coverage',
message: 'not found',
})
t.create('test coverage percentage for repo without test reports')
.get('/c/angular/angular.js.json')
.expectBadge({
label: 'coverage',
message: 'unknown',
})