Passed
Push — trunk ( 17b9ed...85c15e )
by Christian
12:23 queued 13s
created

src/Administration/Resources/app/administration/src/app/init-post/language.init.spec.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 21
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 3
mnd 0
bc 0
fnc 3
bpm 0
cpm 1
noi 2
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);
0 ignored issues
show
Bug introduced by
The variable jest seems to be never declared. If this is a global, consider adding a /** global: jest */ comment.

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.

Loading history...
6
        Shopware.Application.$container.resetProviders();
0 ignored issues
show
Bug introduced by
The variable Shopware seems to be never declared. If this is a global, consider adding a /** global: Shopware */ comment.

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.

Loading history...
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