Passed
Push — master ( 2023a1...168329 )
by Christian
12:04 queued 11s
created

src/Administration/Resources/app/administration/test/module/sw-settings-seo/page/sw-settings-seo.spec.js   A

Complexity

Total Complexity 8
Complexity/F 1

Size

Lines of Code 72
Function Count 8

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 49
dl 0
loc 72
rs 10
c 0
b 0
f 0
wmc 8
mnd 0
bc 0
fnc 8
bpm 0
cpm 1
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A sw-settings-seo.spec.js ➔ createWrapper 0 31 3
1
import { shallowMount } from '@vue/test-utils';
2
import 'src/module/sw-settings-seo/page/sw-settings-seo';
3
import 'src/app/component/structure/sw-page';
4
import 'src/app/component/structure/sw-card-view';
5
import 'src/module/sw-settings/component/sw-system-config';
6
import 'src/app/component/base/sw-card';
7
8
const classes = {
9
    root: 'sw-page__main-content',
10
    cardView: 'sw-card-view',
11
    templateCard: 'sw-seo-url-template-card',
12
    systemConfig: 'sw-system-config',
13
    settingsCard: 'sw-card'
14
};
15
16
function createWrapper() {
17
    return shallowMount(Shopware.Component.build('sw-settings-seo'), {
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...
18
        stubs: {
19
            'sw-page': Shopware.Component.build('sw-page'),
20
            'sw-icon': true,
21
            'sw-button': true,
22
            'sw-card-view': Shopware.Component.build('sw-card-view'),
23
            'sw-seo-url-template-card': true,
24
            'sw-system-config': Shopware.Component.build('sw-system-config'),
25
            'sw-search-bar': true,
26
            'sw-notification-center': true,
27
            'sw-card': Shopware.Component.build('sw-card'),
28
            'sw-loader': true
29
        },
30
        mocks: {
31
            $tc: v => v,
32
            $route: {
33
                meta: {
34
35
                }
36
            }
37
        },
38
        provide: {
39
            systemConfigApiService: {
40
                getConfig: () => Promise.resolve({
41
                    'core.seo.redirectToCanonicalUrl': true
42
                })
43
            }
44
        }
45
    });
46
}
47
48
describe('src/module/sw-settings-seo/page/sw-settings-seo', () => {
49
    let wrapper;
50
51
    beforeEach(() => {
52
        wrapper = createWrapper();
53
    });
54
55
    afterEach(() => {
56
        wrapper.destroy();
57
    });
58
59
    it('should be a Vue.js component', () => {
60
        expect(wrapper.isVueInstance()).toBeTruthy();
61
    });
62
63
    it('should contain the settings card', () => {
64
        expect(
65
            wrapper.find(`.${classes.root}`)
66
                .find(`.${classes.cardView}`)
67
                .find(`.${classes.systemConfig}`)
68
                .find(`.${classes.settingsCard}`)
69
                .exists()
70
        ).toBeTruthy();
71
    });
72
});
73