1
|
|
|
import initState from 'src/app/init-pre/state.init'; |
2
|
|
|
|
3
|
|
|
describe('src/app/init-pre/state.init.ts', () => { |
4
|
|
|
initState(); |
5
|
|
|
|
6
|
|
|
it('should contain all state methods', () => { |
7
|
|
|
expect(Shopware.State._store).toBeDefined(); |
|
|
|
|
8
|
|
|
expect(Shopware.State.list).toBeDefined(); |
9
|
|
|
expect(Shopware.State.get).toBeDefined(); |
10
|
|
|
expect(Shopware.State.getters).toBeDefined(); |
11
|
|
|
expect(Shopware.State.commit).toBeDefined(); |
12
|
|
|
expect(Shopware.State.dispatch).toBeDefined(); |
13
|
|
|
expect(Shopware.State.watch).toBeDefined(); |
14
|
|
|
expect(Shopware.State.subscribe).toBeDefined(); |
15
|
|
|
expect(Shopware.State.subscribeAction).toBeDefined(); |
16
|
|
|
expect(Shopware.State.registerModule).toBeDefined(); |
17
|
|
|
expect(Shopware.State.unregisterModule).toBeDefined(); |
18
|
|
|
}); |
19
|
|
|
|
20
|
|
|
it('should initialized all state modules', () => { |
21
|
|
|
expect(Shopware.State.list()).toHaveLength(21); |
|
|
|
|
22
|
|
|
|
23
|
|
|
expect(Shopware.State.get('notification')).toBeDefined(); |
24
|
|
|
expect(Shopware.State.get('session')).toBeDefined(); |
25
|
|
|
expect(Shopware.State.get('system')).toBeDefined(); |
26
|
|
|
expect(Shopware.State.get('adminMenu')).toBeDefined(); |
27
|
|
|
expect(Shopware.State.get('licenseViolation')).toBeDefined(); |
28
|
|
|
expect(Shopware.State.get('context')).toBeDefined(); |
29
|
|
|
expect(Shopware.State.get('error')).toBeDefined(); |
30
|
|
|
expect(Shopware.State.get('settingsItems')).toBeDefined(); |
31
|
|
|
expect(Shopware.State.get('shopwareApps')).toBeDefined(); |
32
|
|
|
expect(Shopware.State.get('extensionEntryRoutes')).toBeDefined(); |
33
|
|
|
expect(Shopware.State.get('marketing')).toBeDefined(); |
34
|
|
|
expect(Shopware.State.get('extensionComponentSections')).toBeDefined(); |
35
|
|
|
expect(Shopware.State.get('extensions')).toBeDefined(); |
36
|
|
|
expect(Shopware.State.get('tabs')).toBeDefined(); |
37
|
|
|
expect(Shopware.State.get('menuItem')).toBeDefined(); |
38
|
|
|
expect(Shopware.State.get('extensionSdkModules')).toBeDefined(); |
39
|
|
|
expect(Shopware.State.get('modals')).toBeDefined(); |
40
|
|
|
expect(Shopware.State.get('extensionMainModules')).toBeDefined(); |
41
|
|
|
expect(Shopware.State.get('actionButtons')).toBeDefined(); |
42
|
|
|
expect(Shopware.State.get('ruleConditionsConfig')).toBeDefined(); |
43
|
|
|
expect(Shopware.State.get('sdkLocation')).toBeDefined(); |
44
|
|
|
}); |
45
|
|
|
}); |
46
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.