mirror of
https://github.com/knex/knex.git
synced 2025-07-13 03:50:42 +00:00
25 lines
561 B
JavaScript
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');
|
||
|
});
|
||
|
});
|
||
|
});
|