Total Complexity | 10 |
Complexity/F | 1.11 |
Lines of Code | 62 |
Function Count | 9 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { createLocalVue, shallowMount } from '@vue/test-utils'; |
||
2 | import Vuex from 'vuex'; |
||
3 | import 'src/module/sw-product/view/sw-product-detail-specifications'; |
||
4 | |||
5 | const { Component, State } = Shopware; |
||
|
|||
6 | |||
7 | function createWrapper(privileges = []) { |
||
8 | const localVue = createLocalVue(); |
||
9 | localVue.use(Vuex); |
||
10 | |||
11 | return shallowMount(Component.build('sw-product-detail-specifications'), { |
||
12 | localVue, |
||
13 | mocks: { |
||
14 | $t: key => key, |
||
15 | $tc: key => key, |
||
16 | $store: State._store |
||
17 | }, |
||
18 | provide: { |
||
19 | feature: { |
||
20 | isActive: () => true |
||
21 | }, |
||
22 | acl: { |
||
23 | can: (identifier) => { |
||
24 | if (!identifier) { |
||
25 | return true; |
||
26 | } |
||
27 | |||
28 | return privileges.includes(identifier); |
||
29 | } |
||
30 | } |
||
31 | }, |
||
32 | stubs: { |
||
33 | 'sw-card': true, |
||
34 | 'sw-product-packaging-form': true, |
||
35 | 'sw-product-detail-properties': true, |
||
36 | 'sw-product-feature-set-form': true, |
||
37 | 'sw-custom-field-set-renderer': true |
||
38 | } |
||
39 | }); |
||
40 | } |
||
41 | |||
42 | describe('src/module/sw-product/view/sw-product-detail-specifications', () => { |
||
43 | beforeAll(() => { |
||
44 | State.registerModule('swProductDetail', { |
||
45 | namespaced: true, |
||
46 | state: { |
||
47 | product: {}, |
||
48 | parentProduct: {}, |
||
49 | customFieldSets: [] |
||
50 | }, |
||
51 | getters: { |
||
52 | isLoading: () => false |
||
53 | } |
||
54 | }); |
||
55 | }); |
||
56 | |||
57 | it('should be a Vue.JS component', () => { |
||
58 | const wrapper = createWrapper(); |
||
59 | |||
60 | expect(wrapper.vm).toBeTruthy(); |
||
61 | }); |
||
62 | }); |
||
63 |
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.