first commit

This commit is contained in:
2026-10-26 18:54:09 +08:00
commit 20a594d834
180 changed files with 18496 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import Notify from "@@/components/Notify/index.vue"
import List from "@@/components/Notify/List.vue"
import { shallowMount } from "@vue/test-utils"
import { describe, expect, it } from "vitest"
describe("notify", () => {
it("正常渲染", () => {
const wrapper = shallowMount(Notify)
expect(wrapper.classes("notify")).toBe(true)
})
})
describe("list", () => {
it("list 长度为 0", () => {
const wrapper = shallowMount(List, {
props: {
data: []
}
})
expect(wrapper.find("el-empty-stub").exists()).toBe(true)
})
it("list 长度不为 0", () => {
const wrapper = shallowMount(List, {
props: {
data: [
{
title: ""
}
]
}
})
expect(wrapper.find("el-empty-stub").exists()).toBe(false)
})
})
+33
View File
@@ -0,0 +1,33 @@
/**
* @description 该文件所有示例均是为了向你演示 Vitest 最基本的用法
* @link https://cn.vitest.dev/api
* @api describe: 形成一个作用域
* @api test/it: 定义了一组关于测试期望的方法,它接收测试名称和一个含有测试期望的函数
* @api expect: 用来创建断言
* @api toBe: 可以用于断言原始类型是否相等,或者对象是否共享相同的引用
* @api toEqual: 断言实际值是否等于接收到的值或具有相同的结构(如果是对象,则递归比较它们)
*/
import { describe, expect, it } from "vitest"
const author1 = {
name: "pany",
email: "939630029@qq.com",
url: "https://github.com/pany-ang"
}
const author2 = {
name: "pany",
email: "939630029@qq.com",
url: "https://github.com/pany-ang"
}
describe("这里填写作用域名称", () => {
it("测试基础数据类型", () => {
expect(1 + 1).toBe(2)
})
it("测试引用类型", () => {
expect(author1).toEqual(author2)
})
})
+40
View File
@@ -0,0 +1,40 @@
import { isArray } from "@@/utils/validate"
import { describe, expect, it } from "vitest"
describe("isArray", () => {
it("string", () => {
expect(isArray("")).toBe(false)
})
it("number", () => {
expect(isArray(1)).toBe(false)
})
it("boolean", () => {
expect(isArray(true)).toBe(false)
})
it("null", () => {
expect(isArray(null)).toBe(false)
})
it("undefined", () => {
expect(isArray(undefined)).toBe(false)
})
it("symbol", () => {
expect(isArray(Symbol())).toBe(false)
})
it("bigInt", () => {
expect(isArray(BigInt(1))).toBe(false)
})
it("object", () => {
expect(isArray({})).toBe(false)
})
it("array object", () => {
expect(isArray([])).toBe(true)
})
})