Files
shields/services/librariesio/librariesio-dependencies.tester.js
Caleb Cartwright 855c9cd261 Remove dev dep imports in production code (#2937)
Fixes #2876 with @paulmelnikow's suggestion 

Moved imports of `ServiceTester` and `createServiceTester` to a separate file so that dev dependencies are not imported by service classes.
2019-02-05 21:51:55 -05:00

53 lines
1.2 KiB
JavaScript

'use strict'
const Joi = require('joi')
const { isDependencyState } = require('../test-validators')
const t = (module.exports = require('../tester').createServiceTester())
t.create('dependencies for releases')
.get('/release/hex/phoenix/1.0.3.json')
.expectJSONTypes(
Joi.object().keys({
name: 'dependencies',
value: isDependencyState,
})
)
t.create('dependencies for releases (project name contains dot)')
.get('/release/nuget/Newtonsoft.Json.json')
.expectJSONTypes(
Joi.object().keys({
name: 'dependencies',
value: isDependencyState,
})
)
t.create('dependencies for github')
.get('/github/pyvesb/notepad4e.json')
.expectJSONTypes(
Joi.object().keys({
name: 'dependencies',
value: isDependencyState,
})
)
t.create('release not found')
.get('/release/hex/invalid/4.0.4.json')
.expectJSON({
name: 'dependencies',
value: 'not available',
})
t.create('no response data')
.get('/github/phoenixframework/phoenix.json')
.intercept(nock =>
nock('https://libraries.io')
.get('/api/github/phoenixframework/phoenix/dependencies')
.reply(200)
)
.expectJSON({
name: 'dependencies',
value: 'invalid',
})