generated from vuestorefront/template-magento
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-utils.js
42 lines (40 loc) · 1 KB
/
test-utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { render } from '@testing-library/vue';
import deepmerge from 'deepmerge';
const $t = (text) => text;
const $n = (text) => text;
const $fc = (text) => text;
const localePath = (path) => path;
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const customRender = (component, options = {}, callback = null) => render(component, deepmerge({
mocks: {
$t,
$n,
$fc,
localePath,
$nuxt: {
context: {
app: {
localePath,
$cookies: {
get: jest.fn(),
},
},
},
},
},
stubs: {
NuxtImg: {
template: '<img src="image-stub.png" class="nuxt-img" alt="image"/>',
},
recaptcha: {
template: '<div data-testid="recaptcha" />',
},
i18n: {
template: '<div><slot /></div>',
},
},
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
}, options), callback);
export * from '@testing-library/vue';
export * from '~/test-utils/mocks';
export { customRender as render };