validate.test.ts 727 B

1234567891011121314151617181920212223242526272829303132
  1. import { describe, expect, it } from "vitest"
  2. import { isArray } from "@/utils/validate"
  3. describe("isArray", () => {
  4. it("String", () => {
  5. expect(isArray("")).toBe(false)
  6. })
  7. it("Number", () => {
  8. expect(isArray(1)).toBe(false)
  9. })
  10. it("Boolean", () => {
  11. expect(isArray(true)).toBe(false)
  12. })
  13. it("Null", () => {
  14. expect(isArray(null)).toBe(false)
  15. })
  16. it("Undefined", () => {
  17. expect(isArray(undefined)).toBe(false)
  18. })
  19. it("Symbol", () => {
  20. expect(isArray(Symbol())).toBe(false)
  21. })
  22. it("BigInt", () => {
  23. expect(isArray(BigInt(1))).toBe(false)
  24. })
  25. it("Object", () => {
  26. expect(isArray({})).toBe(false)
  27. })
  28. it("Array Object", () => {
  29. expect(isArray([])).toBe(true)
  30. })
  31. })