diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-05 06:08:56 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-05 06:08:56 +0000 |
commit | d10e04a10b5c7bf4e46589f05e8b63db30b3972d (patch) | |
tree | 123337379e990ab52fa976c6f71289c23f4baa40 /spec/frontend/helpers | |
parent | 7c7c4fade6f8f1085a95bf48ae90222345f05bee (diff) | |
download | gitlab-ce-d10e04a10b5c7bf4e46589f05e8b63db30b3972d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/helpers')
-rw-r--r-- | spec/frontend/helpers/fake_date.js | 2 | ||||
-rw-r--r-- | spec/frontend/helpers/fake_date_spec.js | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/spec/frontend/helpers/fake_date.js b/spec/frontend/helpers/fake_date.js index 8417b1c520a..387747ab5bd 100644 --- a/spec/frontend/helpers/fake_date.js +++ b/spec/frontend/helpers/fake_date.js @@ -15,7 +15,7 @@ export const createFakeDateClass = ctorDefault => { apply: (target, thisArg, argArray) => { const ctorArgs = argArray.length ? argArray : ctorDefault; - return RealDate(...ctorArgs); + return new RealDate(...ctorArgs).toString(); }, // We want to overwrite the default 'now', but only if it's not already mocked get: (target, prop) => { diff --git a/spec/frontend/helpers/fake_date_spec.js b/spec/frontend/helpers/fake_date_spec.js index 8afc8225f9b..b3ed13e238a 100644 --- a/spec/frontend/helpers/fake_date_spec.js +++ b/spec/frontend/helpers/fake_date_spec.js @@ -13,13 +13,17 @@ describe('spec/helpers/fake_date', () => { }); it('should use default args', () => { - expect(new FakeDate()).toEqual(new Date(...DEFAULT_ARGS)); - expect(FakeDate()).toEqual(Date(...DEFAULT_ARGS)); + expect(new FakeDate()).toMatchInlineSnapshot(`2020-07-06T00:00:00.000Z`); + }); + + it('should use default args when called as a function', () => { + expect(FakeDate()).toMatchInlineSnapshot( + `"Mon Jul 06 2020 00:00:00 GMT+0000 (Greenwich Mean Time)"`, + ); }); it('should have deterministic now()', () => { - expect(FakeDate.now()).not.toBe(Date.now()); - expect(FakeDate.now()).toBe(new Date(...DEFAULT_ARGS).getTime()); + expect(FakeDate.now()).toMatchInlineSnapshot(`1593993600000`); }); it('should be instanceof Date', () => { |