mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-18 21:21:06 +02:00
* install ember-sinon-qunit * replace stubbed timestamps part 1 * replace clients/ timestamp stubs * actually stub correctly * oops got a little excited, these dont need replacing * and revert client ones as well * oh my gosh claire stop rushing * there we go * move timestamp stub to beforeEach * more moves to beforeEach * final CE test moves to beforeEach hook! * use .replace and .fake instead of callsFake * license-banner test * remove remaining callsFake for consistency * use the timestamp instead of separate date
20 lines
607 B
JavaScript
20 lines
607 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import timestamp from 'core/utils/timestamp';
|
|
import sinon from 'sinon';
|
|
import { module, test } from 'qunit';
|
|
|
|
/*
|
|
This test coverage is more for an example than actually covering the utility
|
|
*/
|
|
module('Unit | Utility | timestamp', function () {
|
|
test('it can be overridden', function (assert) {
|
|
sinon.replace(timestamp, 'now', sinon.fake.returns(new Date('2030-03-03T03:30:03')));
|
|
const result = timestamp.now();
|
|
assert.strictEqual(result.toISOString(), new Date('2030-03-03T03:30:03').toISOString());
|
|
});
|
|
});
|