vault/ui/tests/unit/utils/timestamp-test.js
claire bontempo b58084291e
install ember-sinon-qunit (#26807)
* 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
2024-05-06 14:11:00 +00:00

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());
});
});