element-plus/packages/utils/__tests__/arrays.test.ts
三咲智子 1d13ebb05d
feat: drop jest (#7248)
* feat: drop jest

* test: remove ssr

* test: rename

* chore: update tsconfig
2022-04-19 16:51:44 +08:00

21 lines
596 B
TypeScript

import { describe, expect, it } from 'vitest'
import { castArray as lodashCastArray } from 'lodash-es'
import { castArray, ensureArray, unique } from '..'
describe('arrays', () => {
it('unique should work', () => {
expect(unique([1, 2, 3, 1])).toEqual([1, 2, 3])
expect(unique([1, 2, 3])).toEqual([1, 2, 3])
})
it('castArray should work', () => {
expect(castArray([1, 2, 3])).toEqual([1, 2, 3])
expect(castArray(0)).toEqual([0])
expect(castArray(undefined)).toEqual([])
})
it('re-export ensureArray', () => {
expect(ensureArray).toBe(lodashCastArray)
})
})