knex/test/unit/migrations/util/timestamp.js
Tolterix 5614c18624
Timestamp UTC Standardization for Migrations (#4245)
Co-authored-by: Igor Savin <iselwin@gmail.com>
2021-02-15 19:27:41 +02:00

25 lines
561 B
JavaScript

const sinon = require('sinon');
const { expect } = require('chai');
const { yyyymmddhhmmss } = require('../../../../lib/migrations/util/timestamp');
describe('timestamp', () => {
let clock;
beforeEach(() => {
clock = sinon.useFakeTimers({
now: new Date('2007-03-01T13:00:00Z'),
});
});
afterEach(() => {
sinon.restore();
clock.restore();
});
describe('yyyymmddhhmmss', () => {
it('Returns UTC time', () => {
const timestamp = yyyymmddhhmmss();
expect(timestamp).to.equal('20070301130000');
});
});
});