-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
17 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
import 'jest-preset-angular/setup-jest'; | ||
import '@angular/localize/init'; | ||
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; | ||
|
||
setupZoneTestEnv(); | ||
|
||
// mocking swagger-ui for tests as it contains some JS incompatible with Jest | ||
// This means we will not be able to test Swagger in our components tests | ||
jest.mock('swagger-ui', () => jest.fn(() => ({ initOAuth: () => jest.fn() }))); | ||
|
||
// Set the mock date globally for all tests | ||
const MOCK_DATE = new Date(1466424490000); // UTC Time: Mon Jun 20 2016 12:08:10.000 | ||
jest.useFakeTimers({ advanceTimers: true }).setSystemTime(MOCK_DATE); | ||
|
||
// Need to define advanceTimers for async calls | ||
jest.useFakeTimers({ advanceTimers: 1, now: MOCK_DATE }); // advance 1ms every 10ms | ||
|
||
// Mock Date.now() so that it always returns the same date | ||
Date.now = jest.fn(() => MOCK_DATE.getTime()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters