35 lines
831 B
TypeScript
Raw Normal View History

2023-02-16 17:36:47 +08:00
import Notify from "@/components/Notify/index.vue"
import NotifyList from "@/components/Notify/NotifyList.vue"
2024-11-18 19:40:44 +08:00
import { shallowMount } from "@vue/test-utils"
import { describe, expect, it } from "vitest"
2023-02-16 17:36:47 +08:00
2024-11-18 19:40:44 +08:00
describe("notify", () => {
2023-02-16 17:36:47 +08:00
it("正常渲染", () => {
const wrapper = shallowMount(Notify)
expect(wrapper.classes("notify")).toBe(true)
})
})
2024-11-18 19:40:44 +08:00
describe("notifyList", () => {
it("list 长度为 0", () => {
2023-02-16 17:36:47 +08:00
const wrapper = shallowMount(NotifyList, {
props: {
list: []
}
})
expect(wrapper.find("el-empty").exists()).toBe(true)
})
2024-11-18 19:40:44 +08:00
it("list 长度不为 0", () => {
2023-02-16 17:36:47 +08:00
const wrapper = shallowMount(NotifyList, {
props: {
list: [
{
title: ""
}
]
}
})
expect(wrapper.find("el-empty").exists()).toBe(false)
})
})