/
githubmirror
/
react-hook-form
Обзор
Документация
Войти
/
githubmirror
/
react-hook-form
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/__tests__/utils/fillEmptyArray.test.ts
18 строк
784 B
Bill
7️⃣ V7 (#3741)
01 апр 2021, 00:14
Не верифицирован
01 апр 2021, 00:14
9555d16
Код
Авторство
О чём код?
import fillEmptyArray from '../../utils/fillEmptyArray'; describe('fillEmptyArray', () => { it('should return an array of undefined or empty array when value is an array', () => { expect(fillEmptyArray([1])).toEqual([undefined]); expect(fillEmptyArray([])).toEqual([]); expect(fillEmptyArray(['2', true])).toEqual([undefined, undefined]); expect(fillEmptyArray([{}, {}])).toEqual([undefined, undefined]); expect(fillEmptyArray([[], [3]])).toEqual([undefined, undefined]); }); it('should return undefined when value is not an array', () => { expect(fillEmptyArray(1)).toEqual(undefined); expect(fillEmptyArray({})).toEqual(undefined); expect(fillEmptyArray('')).toEqual(undefined); expect(fillEmptyArray(true)).toEqual(undefined); }); });