deprecatedService: rename url to route for consistency; test on [versioneye] (#2938)
This commit is contained in:
@@ -4,14 +4,14 @@ const BaseService = require('./base')
|
||||
const { Deprecated } = require('./errors')
|
||||
|
||||
// Only `url` is required.
|
||||
function deprecatedService({ url, label, category, examples = [], message }) {
|
||||
function deprecatedService({ route, label, category, examples = [], message }) {
|
||||
return class DeprecatedService extends BaseService {
|
||||
static get category() {
|
||||
return category
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return url
|
||||
return route
|
||||
}
|
||||
|
||||
static get isDeprecated() {
|
||||
|
||||
@@ -4,30 +4,30 @@ const { expect } = require('chai')
|
||||
const deprecatedService = require('./deprecated-service')
|
||||
|
||||
describe('DeprecatedService', function() {
|
||||
const url = {
|
||||
const route = {
|
||||
base: 'coverity/ondemand',
|
||||
format: '(?:.+)',
|
||||
}
|
||||
|
||||
it('returns true on isDeprecated', function() {
|
||||
const service = deprecatedService({ url })
|
||||
const service = deprecatedService({ route })
|
||||
expect(service.isDeprecated).to.be.true
|
||||
})
|
||||
|
||||
it('sets specified route', function() {
|
||||
const service = deprecatedService({ url })
|
||||
expect(service.route).to.deep.equal(url)
|
||||
const service = deprecatedService({ route })
|
||||
expect(service.route).to.deep.equal(route)
|
||||
})
|
||||
|
||||
it('sets specified label', function() {
|
||||
const label = 'coverity'
|
||||
const service = deprecatedService({ url, label })
|
||||
const service = deprecatedService({ route, label })
|
||||
expect(service.defaultBadgeData.label).to.equal(label)
|
||||
})
|
||||
|
||||
it('sets specified category', function() {
|
||||
const category = 'analysis'
|
||||
const service = deprecatedService({ url, category })
|
||||
const service = deprecatedService({ route, category })
|
||||
expect(service.category).to.equal(category)
|
||||
})
|
||||
|
||||
@@ -37,12 +37,12 @@ describe('DeprecatedService', function() {
|
||||
title: 'Not sure we would have examples',
|
||||
},
|
||||
]
|
||||
const service = deprecatedService({ url, examples })
|
||||
const service = deprecatedService({ route, examples })
|
||||
expect(service.examples).to.deep.equal(examples)
|
||||
})
|
||||
|
||||
it('uses default deprecation message when no message specified', async function() {
|
||||
const service = deprecatedService({ url })
|
||||
const service = deprecatedService({ route })
|
||||
expect(await service.invoke()).to.deep.equal({
|
||||
isError: true,
|
||||
color: 'lightgray',
|
||||
@@ -52,7 +52,7 @@ describe('DeprecatedService', function() {
|
||||
|
||||
it('uses custom deprecation message when specified', async function() {
|
||||
const message = 'extended outage'
|
||||
const service = deprecatedService({ url, message })
|
||||
const service = deprecatedService({ route, message })
|
||||
expect(await service.invoke()).to.deep.equal({
|
||||
isError: true,
|
||||
color: 'lightgray',
|
||||
|
||||
@@ -18,7 +18,7 @@ Add a key for the service with the corresponding date for deprecation, for examp
|
||||
|
||||
Locate the source file(s) for the service, which can be found in `*.service.js` files located within the directory for the service (`./services/:service-name/`) such as `./services/imagelayers/imagelayers.service.js`.
|
||||
|
||||
Replace the existing service class implementation with the `DeprecatedService` class from `./core/base-service/deprecated-service.js` using the respective `category`, `url`, and `label` values for that service. For example:
|
||||
Replace the existing service class implementation with the `DeprecatedService` class from `./core/base-service/deprecated-service.js` using the respective `category`, `route`, and `label` values for that service. For example:
|
||||
|
||||
```js
|
||||
'use strict'
|
||||
@@ -28,7 +28,7 @@ const { deprecatedService } = require('..')
|
||||
// image layers integration - deprecated as of November 2018.
|
||||
module.exports = deprecatedService({
|
||||
category: 'size',
|
||||
url: {
|
||||
route: {
|
||||
base: 'imagelayers',
|
||||
format: '(?:.+)',
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ const { deprecatedService } = require('..')
|
||||
// bitHound integration - deprecated as of July 2018
|
||||
module.exports = deprecatedService({
|
||||
category: 'dependencies',
|
||||
url: {
|
||||
route: {
|
||||
base: 'bithound',
|
||||
format: '(?:code/|dependencies/|devDependencies/)?(?:.+?)',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
module.exports = deprecatedService({
|
||||
category: 'other',
|
||||
url: {
|
||||
route: {
|
||||
base: 'cauditor',
|
||||
format: '(?:mi|ccn|npath|hi|i|ca|ce|dit)/(?:[^/]+)/(?:[^/]+)/(?:.+)',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
module.exports = deprecatedService({
|
||||
category: 'other',
|
||||
url: {
|
||||
route: {
|
||||
base: 'cocoapods',
|
||||
pattern: ':interval(aw|at)/:spec',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
module.exports = deprecatedService({
|
||||
category: 'downloads',
|
||||
url: {
|
||||
route: {
|
||||
base: 'cocoapods',
|
||||
pattern: ':interval(dm|dw|dt)/:spec',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
// coverity on demand integration - deprecated as of December 2018.
|
||||
module.exports = deprecatedService({
|
||||
url: {
|
||||
route: {
|
||||
base: 'coverity/ondemand',
|
||||
format: '(?:.+)',
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ const { deprecatedService } = require('..')
|
||||
// https://community.synopsys.com/s/article/Coverity-Scan-Update
|
||||
// https://github.com/badges/shields/issues/2722
|
||||
module.exports = deprecatedService({
|
||||
url: {
|
||||
route: {
|
||||
base: 'coverity/scan',
|
||||
format: '(?:.+)',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
// dockbit integration - deprecated as of December 2017.
|
||||
module.exports = deprecatedService({
|
||||
category: 'build',
|
||||
url: {
|
||||
route: {
|
||||
base: 'dockbit',
|
||||
format: '(?:.+)',
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ const { deprecatedService } = require('..')
|
||||
// dotnet-status integration - deprecated as of April 2018.
|
||||
module.exports = deprecatedService({
|
||||
category: 'dependencies',
|
||||
url: {
|
||||
route: {
|
||||
base: 'dotnetstatus',
|
||||
format: '(?:.+)',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
module.exports = deprecatedService({
|
||||
category: 'dependencies',
|
||||
url: {
|
||||
route: {
|
||||
base: 'gemnasium',
|
||||
format: '(?:.+)',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
module.exports = deprecatedService({
|
||||
category: 'funding',
|
||||
url: {
|
||||
route: {
|
||||
format: '(?:gittip|gratipay(?:/user|/team|/project)?)/(?:.*)',
|
||||
},
|
||||
label: 'gratipay',
|
||||
|
||||
@@ -5,7 +5,7 @@ const { deprecatedService } = require('..')
|
||||
// image layers integration - deprecated as of November 2018.
|
||||
module.exports = deprecatedService({
|
||||
category: 'size',
|
||||
url: {
|
||||
route: {
|
||||
base: 'imagelayers',
|
||||
format: '(?:.+)',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
module.exports = deprecatedService({
|
||||
category: 'issue-tracking',
|
||||
url: {
|
||||
route: {
|
||||
base: 'issuestats',
|
||||
format: '(?:[^/]+)(?:/long)?/(?:[^/]+)/(?:.+)',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
module.exports = deprecatedService({
|
||||
category: 'rating',
|
||||
url: {
|
||||
route: {
|
||||
base: 'libscore',
|
||||
format: 's/(?:.+)',
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ const { deprecatedService } = require('..')
|
||||
// Magnum CI integration - deprecated as of July 2018
|
||||
module.exports = deprecatedService({
|
||||
category: 'build',
|
||||
url: {
|
||||
route: {
|
||||
base: 'magnumci/ci',
|
||||
format: '(?:[^/]+)(?:/(?:.+))?',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
// nsp integration - deprecated as of December 2018.
|
||||
module.exports = deprecatedService({
|
||||
url: {
|
||||
route: {
|
||||
base: 'nsp/npm',
|
||||
format: '(?:.+)',
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const { deprecatedService } = require('..')
|
||||
|
||||
module.exports = deprecatedService({
|
||||
category: 'build',
|
||||
url: {
|
||||
route: {
|
||||
format: 'snap(?:-ci?)/(?:[^/]+/[^/]+)(?:/(?:.+))',
|
||||
},
|
||||
label: 'snap ci',
|
||||
|
||||
@@ -5,7 +5,7 @@ const { deprecatedService } = require('..')
|
||||
// VersionEye integration - deprecated as of August 2018.
|
||||
module.exports = deprecatedService({
|
||||
category: 'downloads',
|
||||
url: {
|
||||
route: {
|
||||
base: 'versioneye',
|
||||
format: 'd/(?:.+)',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user