summaryrefslogtreecommitdiff
path: root/spec/frontend/releases
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-27 21:06:31 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-27 21:06:31 +0000
commit24f023b1154ef53149f5f5fdd1e81c7b457b7eac (patch)
tree627ab428c88a18e988bbc2b6bb12ce3a35088af9 /spec/frontend/releases
parentcc5d0271c249636bae1de55de9c2bf815d669afa (diff)
downloadgitlab-ce-24f023b1154ef53149f5f5fdd1e81c7b457b7eac.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/releases')
-rw-r--r--spec/frontend/releases/list/components/release_block_spec.js12
1 files changed, 12 insertions, 0 deletions
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', () => {