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