2024-11-27 10:31:51 +08:00
|
|
|
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)
|
|
|
|
})
|
|
|
|
})
|