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.
41 lines
911 B
JavaScript
41 lines
911 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('joi')
|
|
const { isMetricOverTimePeriod } = require('../test-validators')
|
|
|
|
const t = (module.exports = require('..').createServiceTester())
|
|
|
|
t.create('commit activity (1 year)')
|
|
.get('/y/eslint/eslint.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'commit activity',
|
|
value: isMetricOverTimePeriod,
|
|
})
|
|
)
|
|
|
|
t.create('commit activity (4 weeks)')
|
|
.get('/4w/eslint/eslint.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'commit activity',
|
|
value: isMetricOverTimePeriod,
|
|
})
|
|
)
|
|
|
|
t.create('commit activity (1 week)')
|
|
.get('/w/eslint/eslint.json')
|
|
.expectJSONTypes(
|
|
Joi.object().keys({
|
|
name: 'commit activity',
|
|
value: isMetricOverTimePeriod,
|
|
})
|
|
)
|
|
|
|
t.create('commit activity (repo not found)')
|
|
.get('/w/badges/helmets.json')
|
|
.expectJSON({
|
|
name: 'commit activity',
|
|
value: 'repo not found',
|
|
})
|