Passed
Push — master ( 173149...e27bf8 )
by Christian
30:25 queued 18:51
created

src/Administration/Resources/app/administration/test/core/data-new/entity-definition.spec.js   A

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 41
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 21
mnd 0
bc 0
fnc 7
dl 0
loc 41
rs 10
bpm 0
cpm 1
noi 5
c 0
b 0
f 0
1
import entitySchemaMock from 'src/../test/_mocks_/entity-schema.json';
2
3
describe('src/core/data-new/entity-hydrator.data', () => {
4
    beforeAll(() => {
5
        Object.entries(entitySchemaMock).forEach(([entityName, entityDefinition]) => {
6
            Shopware.EntityDefinition.add(entityName, entityDefinition);
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
    });
9
10
    it('should be a jsonObject field', () => {
11
        const schema = Shopware.EntityDefinition.get('product');
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...
12
13
        const result = schema.isJsonObjectField({ type: 'json_object' });
14
15
        expect(result).toBe(true);
16
    });
17
18
    it('should not be a jsonObject field', () => {
19
        const schema = Shopware.EntityDefinition.get('product');
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...
20
21
        const result = schema.isJsonObjectField({ type: 'json' });
22
23
        expect(result).toBe(false);
24
    });
25
26
    it('should be a jsonList field', () => {
27
        const schema = Shopware.EntityDefinition.get('product');
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...
28
29
        const result = schema.isJsonListField({ type: 'json_list' });
30
31
        expect(result).toBe(true);
32
    });
33
34
    it('should not be a jsonList field', () => {
35
        const schema = Shopware.EntityDefinition.get('product');
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...
36
37
        const result = schema.isJsonListField({ type: 'json' });
38
39
        expect(result).toBe(false);
40
    });
41
});
42