Files
shields/services/github/github-manifest.tester.js
Paul Melnikow 226fa67a02 Create shortcut for BaseService-related imports (#2809)
Continue to implement #2698:

- Add `core/base-service/index.js` (but hold off on moving the things it imports)
- Add shortcuts in `services/index.js` for Base*Service, errors, and deprecatedService. This file will be streamlined later to avoid cluttering it with rarely used bits.
- Apply consistent ordering of imports and use of `module.exports` in testers.
- Remove some renaming of imports.
- Remove obsolete tests here and there.
2019-01-21 15:41:24 -05:00

45 lines
1.2 KiB
JavaScript

'use strict'
const Joi = require('joi')
const { ServiceTester } = require('..')
const { isVPlusDottedVersionAtLeastOne } = require('../test-validators')
const t = (module.exports = new ServiceTester({
id: 'GithubManifest',
title: 'GithubManifest',
pathPrefix: '/github/manifest-json',
}))
t.create('Manifest version')
.get('/v/RedSparr0w/IndieGala-Helper.json')
.expectJSONTypes(
Joi.object().keys({
name: 'version',
value: isVPlusDottedVersionAtLeastOne,
})
)
t.create('Manifest name')
.get('/n/RedSparr0w/IndieGala-Helper.json')
.expectJSON({ name: 'name', value: 'IndieGala Helper' })
t.create('Manifest array')
.get('/permissions/RedSparr0w/IndieGala-Helper.json')
.expectJSONTypes(
Joi.object().keys({
name: 'permissions',
value: Joi.string().regex(/.*?,/),
})
)
t.create('Manifest object')
.get('/background/RedSparr0w/IndieGala-Helper.json')
.expectJSON({ name: 'manifest', value: 'invalid key value' })
t.create('Manifest invalid json response')
.get('/v/RedSparr0w/not-a-real-project.json')
.expectJSON({
name: 'version',
value: 'repo not found, branch not found, or manifest.json missing',
})