forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils_spec.ts
More file actions
51 lines (40 loc) · 1.8 KB
/
utils_spec.ts
File metadata and controls
51 lines (40 loc) · 1.8 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
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { isZonelessApp } from './utils';
describe('isZonelessApp', () => {
it('should return true when polyfills is undefined', () => {
expect(isZonelessApp(undefined)).toBeTrue();
});
it('should return true when polyfills is an empty array', () => {
expect(isZonelessApp([])).toBeTrue();
});
it('should return false when polyfills contains "zone.js"', () => {
expect(isZonelessApp(['zone.js'])).toBeFalse();
});
it('should return false when polyfills contains "zone.js" among other entries', () => {
expect(isZonelessApp(['some-polyfill', 'zone.js'])).toBeFalse();
});
it('should return true when polyfills contains only non-zone.js package names', () => {
expect(isZonelessApp(['some-polyfill'])).toBeTrue();
});
it('should return true when polyfills contains custom .ts files without zone.js', () => {
expect(isZonelessApp(['./polyfill-buffer.ts'])).toBeTrue();
});
it('should return true when polyfills contains custom .js files without zone.js', () => {
expect(isZonelessApp(['./custom-polyfill.js'])).toBeTrue();
});
it('should return true when polyfills contains custom .mjs files without zone.js', () => {
expect(isZonelessApp(['./polyfill.mjs'])).toBeTrue();
});
it('should return true when polyfills contains a mix of file polyfills and package names without zone.js', () => {
expect(isZonelessApp(['./polyfill-buffer.ts', 'some-polyfill', './other.js'])).toBeTrue();
});
it('should return false when polyfills contains file polyfills and zone.js', () => {
expect(isZonelessApp(['./polyfill-buffer.ts', 'zone.js'])).toBeFalse();
});
});