Files
shields/lib/deprecation-helpers.spec.js
Paul Melnikow 8fde79b793 Make tests more resilient to time zone (#1558)
These tests were failing locally and I suspect it’s because I’m in a different time zone.
2018-03-08 11:09:26 -08:00

40 lines
1.1 KiB
JavaScript

'use strict';
const { expect } = require('chai');
const { test, given } = require('sazerac');
const { isDeprecated, getDeprecatedBadge } = require('./deprecation-helpers');
describe('Deprecated Badge Helper', function() {
it('makes "no longer available" badge', function() {
const badge = getDeprecatedBadge('foo', {});
expect(badge.text[0]).to.equal('foo');
expect(badge.text[1]).to.equal('no longer available');
expect(badge.colorscheme).to.equal('lightgray');
});
it('ignores colorB param', function() {
const badge = getDeprecatedBadge('foo', {colorB: 'fedcba'});
expect(badge.colorscheme).to.equal('lightgray');
});
});
describe('isDeprecated function', function () {
test(isDeprecated, function () {
given('fooservice', new Date(), {}).expect(false);
given(
'fooservice',
new Date('2001-01-11 23:59:00Z'),
{'fooservice': new Date('2001-01-12')}
).expect(false);
given(
'fooservice',
new Date('2001-01-12 00:00:01Z'),
{'fooservice': new Date('2001-01-12')}
).expect(true);
});
});