-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRunConfig.test.tsx
55 lines (48 loc) · 1.74 KB
/
RunConfig.test.tsx
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
import 'react-native';
import { AbTesting } from '../src/business/RunConfig/ABTesting';
import RunConfig from '../src/business/RunConfig/RunConfig';
import React from 'react';
import { View } from 'react-native';
describe('RunConfig', () => {
let runConfig: RunConfig;
let abTesting: AbTesting;
beforeEach(() => {
abTesting = AbTesting.A;
runConfig = new RunConfig({
playground: <View />,
ifShowRunConfigInTheConfigScreen: true,
ifPrintsDebugInfoToConsole: true,
abTesting: abTesting,
});
});
it('should initialize with provided values.', () => {
expect(runConfig.playground).not.toBeNull();
expect(runConfig.ifShowRunConfigInTheConfigScreen).toBe(true);
expect(runConfig.ifPrintsDebugInfoToConsole).toBe(true);
expect(runConfig.abTesting).toBe(abTesting);
});
it('should update values when set is called.', () => {
runConfig.set({
playground: null,
ifShowRunConfigInTheConfigScreen: false,
ifPrintsDebugInfoToConsole: false,
abTesting: AbTesting.B,
});
expect(runConfig.playground).toBeNull();
expect(runConfig.ifShowRunConfigInTheConfigScreen).toBe(false);
expect(runConfig.ifPrintsDebugInfoToConsole).toBe(false);
expect(runConfig.abTesting).not.toBe(abTesting);
});
it('should not update values when undefined is passed to set.', () => {
runConfig.set({
playground: undefined,
ifShowRunConfigInTheConfigScreen: undefined,
ifPrintsDebugInfoToConsole: undefined,
abTesting: undefined,
});
expect(runConfig.playground).not.toBeNull();
expect(runConfig.ifShowRunConfigInTheConfigScreen).toBe(true);
expect(runConfig.ifPrintsDebugInfoToConsole).toBe(true);
expect(runConfig.abTesting).toBe(abTesting);
});
});