Total Complexity | 7 |
Complexity/F | 1 |
Lines of Code | 41 |
Function Count | 7 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 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); |
||
|
|||
7 | }); |
||
8 | }); |
||
9 | |||
10 | it('should be a jsonObject field', () => { |
||
11 | const schema = Shopware.EntityDefinition.get('product'); |
||
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'); |
||
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'); |
||
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'); |
||
36 | |||
37 | const result = schema.isJsonListField({ type: 'json' }); |
||
38 | |||
39 | expect(result).toBe(false); |
||
40 | }); |
||
41 | }); |
||
42 |
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.