Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-21 11:29:20 +08:00
v3-admin-vite/tests/components/Notify.test.ts

35 lines
813 B
TypeScript
Raw Permalink Normal View History

import Notify from "@@/components/Notify/index.vue"
2024-12-03 13:57:57 +08:00
import List from "@@/components/Notify/List.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-12-03 13:57:57 +08:00
describe("list", () => {
2024-11-18 19:40:44 +08:00
it("list 长度为 0", () => {
2024-12-03 13:57:57 +08:00
const wrapper = shallowMount(List, {
2023-02-16 17:36:47 +08:00
props: {
2024-11-22 21:13:49 +08:00
data: []
2023-02-16 17:36:47 +08:00
}
})
2024-12-03 18:42:34 +08:00
expect(wrapper.find("el-empty-stub").exists()).toBe(true)
2023-02-16 17:36:47 +08:00
})
2024-11-18 19:40:44 +08:00
it("list 长度不为 0", () => {
2024-12-03 13:57:57 +08:00
const wrapper = shallowMount(List, {
2023-02-16 17:36:47 +08:00
props: {
2024-11-22 21:13:49 +08:00
data: [
2023-02-16 17:36:47 +08:00
{
title: ""
}
]
}
})
2024-12-03 18:42:34 +08:00
expect(wrapper.find("el-empty-stub").exists()).toBe(false)
2023-02-16 17:36:47 +08:00
})
})