Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-22 03:49:19 +08:00
v3-admin-vite/tests/utils/validate.test.ts

33 lines
728 B
TypeScript
Raw Permalink Normal View History

import { isArray } from "@@/utils/validate"
2024-11-18 19:40:44 +08:00
import { describe, expect, it } from "vitest"
2023-02-16 17:36:47 +08:00
describe("isArray", () => {
2024-11-18 19:40:44 +08:00
it("string", () => {
2023-02-16 17:36:47 +08:00
expect(isArray("")).toBe(false)
})
2024-11-18 19:40:44 +08:00
it("number", () => {
2023-02-16 17:36:47 +08:00
expect(isArray(1)).toBe(false)
})
2024-11-18 19:40:44 +08:00
it("boolean", () => {
2023-02-16 17:36:47 +08:00
expect(isArray(true)).toBe(false)
})
2024-11-18 19:40:44 +08:00
it("null", () => {
2023-02-16 17:36:47 +08:00
expect(isArray(null)).toBe(false)
})
2024-11-18 19:40:44 +08:00
it("undefined", () => {
2023-02-16 17:36:47 +08:00
expect(isArray(undefined)).toBe(false)
})
2024-11-18 19:40:44 +08:00
it("symbol", () => {
2023-02-16 17:36:47 +08:00
expect(isArray(Symbol())).toBe(false)
})
2024-11-18 19:40:44 +08:00
it("bigInt", () => {
2023-02-16 17:36:47 +08:00
expect(isArray(BigInt(1))).toBe(false)
})
2024-11-18 19:40:44 +08:00
it("object", () => {
2023-02-16 17:36:47 +08:00
expect(isArray({})).toBe(false)
})
2024-11-18 19:40:44 +08:00
it("array object", () => {
2023-02-16 17:36:47 +08:00
expect(isArray([])).toBe(true)
})
})