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',
|
||||
|
||||
Reference in New Issue
Block a user