-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
Copy pathPublicEnvironment.test.js
52 lines (49 loc) · 1.55 KB
/
PublicEnvironment.test.js
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
// @flow strict-local
import assert from 'assert';
import {createEnvironment} from '../src/Environment';
import PublicEnvironment from '../src/public/Environment';
import {DEFAULT_OPTIONS} from './test-utils';
describe('Public Environment', () => {
it('has correct support data for ChromeAndroid', () => {
let env = new PublicEnvironment(
createEnvironment({
engines: {
browsers: ['last 1 Chrome version', 'last 1 ChromeAndroid version'],
},
}),
DEFAULT_OPTIONS,
);
assert(env.supports('esmodules'));
assert(env.supports('dynamic-import'));
assert(env.supports('worker-module'));
assert(env.supports('import-meta-url'));
assert(env.supports('arrow-functions'));
});
it('matches browserslist for es6-modules support', () => {
let env = new PublicEnvironment(
createEnvironment({
engines: {browsers: 'fully supports es6-module'},
}),
DEFAULT_OPTIONS,
);
assert(env.supports('esmodules'));
});
it('matches browserslist for dynamic-imports support', () => {
let env = new PublicEnvironment(
createEnvironment({
engines: {browsers: 'fully supports es6-module-dynamic-import'},
}),
DEFAULT_OPTIONS,
);
assert(env.supports('dynamic-import'));
});
it('matches browserslist for arrow-functions support', () => {
let env = new PublicEnvironment(
createEnvironment({
engines: {browsers: 'fully supports arrow-functions'},
}),
DEFAULT_OPTIONS,
);
assert(env.supports('arrow-functions'));
});
});