wip: 更新单测

This commit is contained in:
pany 2024-12-03 13:57:57 +08:00
parent fb6b42d753
commit a3f6c45866
2 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import Notify from "@@/components/Notify/index.vue" import Notify from "@@/components/Notify/index.vue"
import NotifyList from "@@/components/Notify/List.vue" import List from "@@/components/Notify/List.vue"
import { shallowMount } from "@vue/test-utils" import { shallowMount } from "@vue/test-utils"
import { describe, expect, it } from "vitest" import { describe, expect, it } from "vitest"
@ -10,9 +10,9 @@ describe("notify", () => {
}) })
}) })
describe("notifyList", () => { describe("list", () => {
it("list 长度为 0", () => { it("list 长度为 0", () => {
const wrapper = shallowMount(NotifyList, { const wrapper = shallowMount(List, {
props: { props: {
data: [] data: []
} }
@ -20,7 +20,7 @@ describe("notifyList", () => {
expect(wrapper.find("el-empty").exists()).toBe(true) expect(wrapper.find("el-empty").exists()).toBe(true)
}) })
it("list 长度不为 0", () => { it("list 长度不为 0", () => {
const wrapper = shallowMount(NotifyList, { const wrapper = shallowMount(List, {
props: { props: {
data: [ data: [
{ {

View File

@ -118,7 +118,12 @@ export default defineConfig(({ mode }) => {
// Configuring Vitest: https://cn.vitest.dev/config // Configuring Vitest: https://cn.vitest.dev/config
test: { test: {
include: ["tests/**/*.test.{ts,js}"], include: ["tests/**/*.test.{ts,js}"],
environment: "jsdom" environment: "jsdom",
server: {
deps: {
inline: ["element-plus"]
}
}
} }
} }
}) })