Commit d1834208 authored by Paul Slaughter's avatar Paul Slaughter

Add useFakeDate in test_setup

parent c26b7daf
...@@ -117,7 +117,7 @@ exports[`MergeRequestTable component template matches the snapshot 1`] = ` ...@@ -117,7 +117,7 @@ exports[`MergeRequestTable component template matches the snapshot 1`] = `
</li> </li>
<li> <li>
opened just now opened 5 months ago
</li> </li>
<li> <li>
......
...@@ -58,8 +58,6 @@ describe('MergeRequestTable component', () => { ...@@ -58,8 +58,6 @@ describe('MergeRequestTable component', () => {
describe('template', () => { describe('template', () => {
beforeEach(() => { beforeEach(() => {
jest.spyOn(global, 'Date').mockImplementationOnce(() => new Date('2020-03-09T11:01:58.135Z'));
bootstrap({ mergeRequests: mockMergeRequests }); bootstrap({ mergeRequests: mockMergeRequests });
}); });
......
...@@ -4,15 +4,12 @@ import NetworkPolicyList from 'ee/threat_monitoring/components/network_policy_li ...@@ -4,15 +4,12 @@ import NetworkPolicyList from 'ee/threat_monitoring/components/network_policy_li
import PolicyDrawer from 'ee/threat_monitoring/components/policy_editor/policy_drawer.vue'; import PolicyDrawer from 'ee/threat_monitoring/components/policy_editor/policy_drawer.vue';
import { PREDEFINED_NETWORK_POLICIES } from 'ee/threat_monitoring/constants'; import { PREDEFINED_NETWORK_POLICIES } from 'ee/threat_monitoring/constants';
import createStore from 'ee/threat_monitoring/store'; import createStore from 'ee/threat_monitoring/store';
import { useFakeDate } from 'helpers/fake_date';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { mockPoliciesResponse } from '../mock_data'; import { mockPoliciesResponse } from '../mock_data';
const mockData = mockPoliciesResponse.map((policy) => convertObjectPropsToCamelCase(policy)); const mockData = mockPoliciesResponse.map((policy) => convertObjectPropsToCamelCase(policy));
describe('NetworkPolicyList component', () => { describe('NetworkPolicyList component', () => {
useFakeDate();
let store; let store;
let wrapper; let wrapper;
......
...@@ -8,6 +8,7 @@ import { initializeTestTimeout } from './__helpers__/timeout'; ...@@ -8,6 +8,7 @@ import { initializeTestTimeout } from './__helpers__/timeout';
import { getJSONFixture, loadHTMLFixture, setHTMLFixture } from './__helpers__/fixtures'; import { getJSONFixture, loadHTMLFixture, setHTMLFixture } from './__helpers__/fixtures';
import { setupManualMocks } from './mocks/mocks_helper'; import { setupManualMocks } from './mocks/mocks_helper';
import customMatchers from './matchers'; import customMatchers from './matchers';
import { useFakeDate } from './helpers/fake_date';
import './__helpers__/dom_shims'; import './__helpers__/dom_shims';
import './__helpers__/jquery'; import './__helpers__/jquery';
...@@ -20,6 +21,8 @@ process.on('unhandledRejection', global.promiseRejectionHandler); ...@@ -20,6 +21,8 @@ process.on('unhandledRejection', global.promiseRejectionHandler);
setupManualMocks(); setupManualMocks();
useFakeDate();
afterEach(() => afterEach(() =>
// give Promises a bit more time so they fail the right test // give Promises a bit more time so they fail the right test
new Promise(setImmediate).then(() => { new Promise(setImmediate).then(() => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment