Files
shields/lib/deprecation-helpers.spec.js
Paul Melnikow 7ad5eca26e Rewrite deprecated services and add tests (#2018)
I've rewritten the deprecated services using the `deprecatedService` helper from #1922. I added a test for `Deprecated`, and for `enforceDeprecation`, which isn't being used right now, but is there for future use.

This also makes it possible to write services using BaseService which do not have any named parameters (with a test).

Ref: #1358
2018-08-30 10:03:15 -07:00

18 lines
511 B
JavaScript

'use strict'
const { expect } = require('chai')
const { Deprecated } = require('../services/errors')
const { enforceDeprecation } = require('./deprecation-helpers')
describe('enforceDeprecation', function() {
it('throws Deprecated for a date in the past', function() {
expect(() => enforceDeprecation(new Date())).to.throw(Deprecated)
})
it('does not throw for a date in the future', function() {
expect(() =>
enforceDeprecation(new Date(Date.now() + 10000))
).not.to.throw()
})
})