mirror of
https://github.com/badges/shields.git
synced 2025-07-24 20:42:04 +03:00
refactor [cocoapods] service (#2977)
* refactor [cocoapods] service * remove pointless default * move join to render()
This commit is contained in:
committed by
Caleb Cartwright
parent
e1a50a7246
commit
b87d67bb18
28
services/cocoapods/cocoapods-docs.tester.js
Normal file
28
services/cocoapods/cocoapods-docs.tester.js
Normal file
@ -0,0 +1,28 @@
|
||||
'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,
|
||||
})
|
||||
)
|
||||
|
||||
t.create('doc percent (null)')
|
||||
.get('/AFNetworking.json')
|
||||
.intercept(nock =>
|
||||
nock('https://metrics.cocoapods.org')
|
||||
.get('/api/v1/pods/AFNetworking')
|
||||
.reply(200, '{"cocoadocs": {"doc_percent": null}}')
|
||||
)
|
||||
.expectJSON({ name: 'docs', value: '0%' })
|
||||
|
||||
t.create('doc percent (not found)')
|
||||
.get('/not-a-package.json')
|
||||
.expectJSON({ name: 'docs', value: 'not found' })
|
Reference in New Issue
Block a user