Files
shields/services/codefactor/codefactor-grade.tester.js
Paul Melnikow fe34bcf28b Throw explicit error on invalid [codefactorgrade] color (#4015)
It’s hard to understand how #3813 is persisting. The schema should reject keys not in the object… it’s very puzzling.

This replaces the code used to get the color with a function call that throws an explicit error when the key is missing. It should at least make it clear what the key value is when this fails in the future.
2019-09-14 11:24:57 -05:00

26 lines
602 B
JavaScript

'use strict'
const t = (module.exports = require('../tester').createServiceTester())
const { isValidGrade } = require('./codefactor-helpers')
t.create('Grade')
.get('/github/google/guava.json')
.expectBadge({
label: 'code quality',
message: isValidGrade,
})
t.create('Grade (branch)')
.get('/github/pallets/flask/master.json')
.expectBadge({
label: 'code quality',
message: isValidGrade,
})
t.create('Grade (nonexistent repo)')
.get('/github/badges/asdfasdfasdfasdfasfae.json')
.expectBadge({
label: 'code quality',
message: 'repo or branch not found',
})