Passed
Push — master ( cebf2c...a52d5f )
by Christian
12:30 queued 11s
created

  B

Complexity

Conditions 6

Size

Total Lines 34
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 23
dl 0
loc 34
rs 8.3946
c 0
b 0
f 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;
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...
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