Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 21 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import initLanguageService from 'src/app/init-post/language.init'; |
||
2 | |||
3 | describe('src/app/init-post/language.init.ts', () => { |
||
4 | it('should init the language service', () => { |
||
5 | const mock = jest.fn(() => null); |
||
|
|||
6 | Shopware.Application.$container.resetProviders(); |
||
7 | |||
8 | Shopware.Service().register('languageAutoFetchingService', mock); |
||
9 | |||
10 | initLanguageService(); |
||
11 | |||
12 | // middleware should not be executed yet |
||
13 | expect(mock).not.toHaveBeenCalled(); |
||
14 | |||
15 | // access repositoryFactory to trigger the middleware |
||
16 | Shopware.Application.getContainer('service').repositoryFactory.create('product'); |
||
17 | |||
18 | // middleware should be executed now |
||
19 | expect(mock).toHaveBeenCalled(); |
||
20 | }); |
||
21 | }); |
||
22 |
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.