1
0
mirror of https://github.com/badges/shields.git synced 2025-07-27 19:01:52 +03:00

Migrated most service tests to use new expectBadge (#3122)

This commit is contained in:
Pierre-Yves B
2019-02-28 21:43:23 +00:00
committed by GitHub
parent 4e2d144f97
commit 1f29c22d3d
230 changed files with 3480 additions and 4439 deletions

View File

@ -1,17 +1,14 @@
'use strict'
const Joi = require('joi')
const { isIntegerPercentage } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('doc percent (valid)')
.get('/AFNetworking.json')
.expectJSONTypes(
Joi.object().keys({
name: 'docs',
value: isIntegerPercentage,
})
)
.expectBadge({
label: 'docs',
message: isIntegerPercentage,
})
t.create('doc percent (null)')
.get('/AFNetworking.json')
@ -20,8 +17,8 @@ t.create('doc percent (null)')
.get('/api/v1/pods/AFNetworking')
.reply(200, '{"cocoadocs": {"doc_percent": null}}')
)
.expectJSON({ name: 'docs', value: '0%' })
.expectBadge({ label: 'docs', message: '0%' })
t.create('doc percent (not found)')
.get('/not-a-package.json')
.expectJSON({ name: 'docs', value: 'not found' })
.expectBadge({ label: 'docs', message: 'not found' })