-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSnackers.nuxt.test.js
More file actions
54 lines (51 loc) · 1.49 KB
/
Snackers.nuxt.test.js
File metadata and controls
54 lines (51 loc) · 1.49 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
// @vitest-environment nuxt
vi.stubGlobal("visualViewport", new EventTarget())
import { describe, expect, test, vi } from "vitest"
import { mount } from "@vue/test-utils"
import * as components from "vuetify/components"
import { setActivePinia } from "pinia"
import { createTestingPinia } from "@pinia/testing"
import FeedBackSnackers from "@ogw_front/components/FeedBack/Snackers"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
import { vuetify } from "../../../utils"
describe("FeedBackSnackers", async () => {
test(`Test delete error`, async () => {
const pinia = createTestingPinia({
initialState: {
feedback: {
feedbacks: [
{
type: "error",
code: 500,
route: "/test",
name: "test message",
description: "test description",
},
],
},
},
stubActions: false,
createSpy: vi.fn,
})
setActivePinia(pinia)
const feedbackStore = useFeedbackStore()
const wrapper = mount(
{
template: "<v-layout><FeedBackSnackers/></v-layout>",
},
{
props: {},
global: {
components: {
FeedBackSnackers,
},
plugins: [pinia, vuetify],
},
},
)
expect(feedbackStore.feedbacks.length).toBe(1)
const v_btn = await wrapper.findComponent(components.VBtn)
await v_btn.trigger("click")
expect(feedbackStore.feedbacks.length).toBe(0)
})
})