Repository navigation
Expand file tree
/
Copy pathtest.ts
More file actions
55 lines (40 loc) · 1.48 KB
/
Copy pathtest.ts
File metadata and controls
55 lines (40 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
import * as faker from 'faker';
import { JASMINE_STYLES } from './test.theme';
declare const require: any;
const SEED = 1337;
const materialIconsLink = document.createElement('link');
materialIconsLink.href = 'https://fonts.googleapis.com/icon?family=Material+Icons';
materialIconsLink.rel = 'stylesheet';
document.head.appendChild(materialIconsLink);
const customStyle = document.createElement('style');
customStyle.innerHTML = JASMINE_STYLES;
document.head.appendChild(customStyle);
const reseed = () => {
faker.seed(SEED);
// overwrite Math.radom again in each global context
Math.random = () => faker.random.number({ min: 0, max: 100000 }) / 100000;
}
beforeEach(reseed);
const __describe = describe;
(global as any).describe = function () {
reseed();
__describe.apply(this, arguments as any);
}
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);