mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
Add useList additional test
This commit is contained in:
parent
85f5d26158
commit
93e76dc48f
@ -1,7 +1,7 @@
|
||||
import { act, renderHook } from '@testing-library/react-hooks';
|
||||
import useList from '../useList';
|
||||
|
||||
const setUp = (initialList: any[]) => renderHook(() => useList(initialList));
|
||||
const setUp = (initialList?: any[]) => renderHook(() => useList(initialList));
|
||||
|
||||
it('should init list and utils', () => {
|
||||
const { result } = setUp([1, 2, 3]);
|
||||
@ -19,6 +19,12 @@ it('should init list and utils', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should init empty list if not initial list provided', () => {
|
||||
const { result } = setUp();
|
||||
|
||||
expect(result.current[0]).toEqual([]);
|
||||
});
|
||||
|
||||
it('should set new list', () => {
|
||||
const initList = [1, 2, 3];
|
||||
const { result } = setUp(initList);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user