diff options
author | 2022-12-08 22:28:46 +0530 | |
---|---|---|
committer | 2022-12-08 16:58:46 +0000 | |
commit | 93d61ced55e7e1c486cdbe6c02c16435ca698860 (patch) | |
tree | e4d9e53260e508711cfcf45232d086e906a09d8e /test/features/utils/FeatureStore.test.js | |
parent | Backported deprecation fixes from electron v22 upgrade (diff) | |
download | ferdium-app-93d61ced55e7e1c486cdbe6c02c16435ca698860.tar.gz ferdium-app-93d61ced55e7e1c486cdbe6c02c16435ca698860.tar.zst ferdium-app-93d61ced55e7e1c486cdbe6c02c16435ca698860.zip |
migrate from gulp to esbuild for faster builds (#815)
Diffstat (limited to 'test/features/utils/FeatureStore.test.js')
-rw-r--r-- | test/features/utils/FeatureStore.test.js | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/test/features/utils/FeatureStore.test.js b/test/features/utils/FeatureStore.test.js deleted file mode 100644 index 3ef8116d9..000000000 --- a/test/features/utils/FeatureStore.test.js +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | import PropTypes from 'prop-types'; | ||
2 | import { observable } from 'mobx'; | ||
3 | import FeatureStore from '../../../src/features/utils/FeatureStore'; | ||
4 | import { createActionsFromDefinitions } from '../../../src/actions/lib/actions'; | ||
5 | import { createActionBindings } from '../../../src/features/utils/ActionBinding'; | ||
6 | import { createReactions } from '../../../src/stores/lib/Reaction'; | ||
7 | |||
8 | const actions = createActionsFromDefinitions( | ||
9 | { | ||
10 | countUp: {}, | ||
11 | }, | ||
12 | PropTypes.checkPropTypes, | ||
13 | ); | ||
14 | |||
15 | class TestFeatureStore extends FeatureStore { | ||
16 | @observable count = 0; | ||
17 | |||
18 | reactionInvokedCount = 0; | ||
19 | |||
20 | start() { | ||
21 | this._registerActions( | ||
22 | createActionBindings([[actions.countUp, this._countUp]]), | ||
23 | ); | ||
24 | this._registerReactions(createReactions([this._countReaction])); | ||
25 | } | ||
26 | |||
27 | _countUp = () => { | ||
28 | this.count += 1; | ||
29 | }; | ||
30 | |||
31 | _countReaction = () => { | ||
32 | this.reactionInvokedCount += 1; | ||
33 | }; | ||
34 | } | ||
35 | |||
36 | describe('FeatureStore', () => { | ||
37 | let store = null; | ||
38 | |||
39 | beforeEach(() => { | ||
40 | store = new TestFeatureStore(); | ||
41 | }); | ||
42 | |||
43 | describe('registering actions', () => { | ||
44 | it('starts the actions', () => { | ||
45 | store.start(); | ||
46 | actions.countUp(); | ||
47 | expect(store.count).toBe(1); | ||
48 | }); | ||
49 | it('starts the reactions', () => { | ||
50 | store.start(); | ||
51 | actions.countUp(); | ||
52 | expect(store.reactionInvokedCount).toBe(1); | ||
53 | }); | ||
54 | }); | ||
55 | |||
56 | describe('stopping the store', () => { | ||
57 | it('stops the actions', () => { | ||
58 | store.start(); | ||
59 | actions.countUp(); | ||
60 | store.stop(); | ||
61 | actions.countUp(); | ||
62 | expect(store.count).toBe(1); | ||
63 | }); | ||
64 | it('stops the reactions', () => { | ||
65 | store.start(); | ||
66 | actions.countUp(); | ||
67 | store.stop(); | ||
68 | store.count += 1; | ||
69 | expect(store.reactionInvokedCount).toBe(1); | ||
70 | }); | ||
71 | }); | ||
72 | |||
73 | describe('toggling the store', () => { | ||
74 | it('restarts the actions correctly', () => { | ||
75 | store.start(); | ||
76 | actions.countUp(); | ||
77 | store.stop(); | ||
78 | actions.countUp(); | ||
79 | store.start(); | ||
80 | actions.countUp(); | ||
81 | expect(store.count).toBe(2); | ||
82 | }); | ||
83 | it('restarts the reactions correctly', () => { | ||
84 | store.start(); | ||
85 | actions.countUp(); | ||
86 | store.stop(); | ||
87 | actions.countUp(); | ||
88 | store.start(); | ||
89 | actions.countUp(); | ||
90 | expect(store.count).toBe(2); | ||
91 | }); | ||
92 | }); | ||
93 | }); | ||