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'), { |
|
|
|
|
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
|
|
|
|
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.