From 24f023b1154ef53149f5f5fdd1e81c7b457b7eac Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Sun, 27 Oct 2019 21:06:31 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/frontend/releases/list/components/release_block_spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'spec/frontend/releases') diff --git a/spec/frontend/releases/list/components/release_block_spec.js b/spec/frontend/releases/list/components/release_block_spec.js index 0b908d7d6bc..ac51c3af11a 100644 --- a/spec/frontend/releases/list/components/release_block_spec.js +++ b/spec/frontend/releases/list/components/release_block_spec.js @@ -39,13 +39,25 @@ describe('Release block', () => { const milestoneListLabel = () => wrapper.find('.js-milestone-list-label'); const editButton = () => wrapper.find('.js-edit-button'); + const RealDate = Date; beforeEach(() => { + // timeago.js calls Date(), so let's mock that case to avoid time-dependent test failures. + const constantDate = new Date('2019-10-25T00:12:00'); + + /* eslint no-global-assign:off */ + global.Date = jest.fn((...props) => + props.length ? new RealDate(...props) : new RealDate(constantDate), + ); + + Object.assign(Date, RealDate); + releaseClone = JSON.parse(JSON.stringify(release)); }); afterEach(() => { wrapper.destroy(); + global.Date = RealDate; }); describe('with default props', () => { -- cgit v1.2.1