2021-04-07 22:27:09 +02:00
|
|
|
import { getAllData } from '../src/lib/icons';
|
2020-10-26 08:59:56 +01:00
|
|
|
import { renderHook } from '@testing-library/react-hooks';
|
2021-04-07 22:27:09 +02:00
|
|
|
import useSearch from '../src/lib/useSearch';
|
2020-10-26 08:59:56 +01:00
|
|
|
|
|
|
|
|
describe('Icon Overview', () => {
|
|
|
|
|
it('can search filter icons', async () => {
|
|
|
|
|
let allData = getAllData();
|
|
|
|
|
|
|
|
|
|
const { result: result1, waitForNextUpdate: wait1 } = renderHook(() => useSearch(allData, ''));
|
|
|
|
|
expect(result1.current).toHaveLength(allData.length);
|
|
|
|
|
|
|
|
|
|
const { result: result2, waitForNextUpdate: wait2 } = renderHook(() =>
|
|
|
|
|
useSearch(allData, 'airplay')
|
|
|
|
|
);
|
|
|
|
|
await wait2();
|
|
|
|
|
expect(result2.current).toHaveLength(2);
|
|
|
|
|
});
|
|
|
|
|
});
|