Notify.test.ts 831 B

12345678910111213141516171819202122232425262728293031323334
  1. import { shallowMount } from "@vue/test-utils"
  2. import { describe, expect, it } from "vitest"
  3. import Notify from "@/components/Notify/index.vue"
  4. import NotifyList from "@/components/Notify/NotifyList.vue"
  5. describe("Notify", () => {
  6. it("正常渲染", () => {
  7. const wrapper = shallowMount(Notify)
  8. expect(wrapper.classes("notify")).toBe(true)
  9. })
  10. })
  11. describe("NotifyList", () => {
  12. it("List 长度为 0", () => {
  13. const wrapper = shallowMount(NotifyList, {
  14. props: {
  15. list: []
  16. }
  17. })
  18. expect(wrapper.find("el-empty").exists()).toBe(true)
  19. })
  20. it("List 长度不为 0", () => {
  21. const wrapper = shallowMount(NotifyList, {
  22. props: {
  23. list: [
  24. {
  25. title: ""
  26. }
  27. ]
  28. }
  29. })
  30. expect(wrapper.find("el-empty").exists()).toBe(false)
  31. })
  32. })