1
0
mirror of https://github.com/badges/shields.git synced 2025-04-26 09:48:52 +03:00
shields/services/cocoapods/cocoapods-docs.tester.js
Paul Melnikow 4bd16f93e8
Sort imports and requires (#3056)
This will definitely save time, and ensure more uniformity.

It moves the `createServiceTester()` calls to a different place from where I'd like them, though I'm happy to have them checked by the linter.

Closes #2701
2019-02-21 22:14:40 -05:00

28 lines
736 B
JavaScript

'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' })