mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-13 17:05:47 +08:00
f83761dd2a
* style(eslint-config): add eslint rules to restrict the imports of lodash * fix: lint error * test(components): [infinite-scroll] test error * test(components): [infinite-scroll] test error
21 lines
601 B
TypeScript
21 lines
601 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { castArray as lodashCastArray } from 'lodash-unified'
|
|
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)
|
|
})
|
|
})
|