-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
pluginConfig-test.ts
46 lines (44 loc) · 1.49 KB
/
pluginConfig-test.ts
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
import { validateConfig } from '../pluginConfig';
describe(validateConfig, () => {
it('should throw error from invalid config type', () => {
expect(() => {
validateConfig(undefined);
}).toThrow();
expect(() => {
validateConfig(null);
}).toThrow();
expect(() => {
validateConfig('foo');
}).toThrow();
expect(() => {
validateConfig({ android: { compileSdkVersion: 'aString' } });
}).toThrow();
});
it('should throw error from unsupported android versions', () => {
expect(() =>
validateConfig({ android: { minSdkVersion: 14 } })
).toThrowErrorMatchingInlineSnapshot(
`"\`android.minSdkVersion\` needs to be at least version 21."`
);
expect(() =>
validateConfig({ android: { compileSdkVersion: 14 } })
).toThrowErrorMatchingInlineSnapshot(
`"\`android.compileSdkVersion\` needs to be at least version 31."`
);
expect(() =>
validateConfig({ android: { targetSdkVersion: 14 } })
).toThrowErrorMatchingInlineSnapshot(
`"\`android.targetSdkVersion\` needs to be at least version 31."`
);
expect(() =>
validateConfig({ android: { kotlinVersion: '1.3.0' } })
).toThrowErrorMatchingInlineSnapshot(
`"\`android.kotlinVersion\` needs to be at least version 1.6.10."`
);
expect(() =>
validateConfig({ ios: { deploymentTarget: '9.0' } })
).toThrowErrorMatchingInlineSnapshot(
`"\`ios.deploymentTarget\` needs to be at least version 13.0."`
);
});
});