From ea2b034024a3c1d283ac56dd80140e887baadfff Mon Sep 17 00:00:00 2001 From: Gildas Garcia Date: Fri, 4 Oct 2019 15:20:08 +0200 Subject: [PATCH] Fix: Stabilize tests --- packages/ra-core/src/controller/useFilterState.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ra-core/src/controller/useFilterState.spec.ts b/packages/ra-core/src/controller/useFilterState.spec.ts index 41125ac5bde..ebdeeed59b7 100644 --- a/packages/ra-core/src/controller/useFilterState.spec.ts +++ b/packages/ra-core/src/controller/useFilterState.spec.ts @@ -27,7 +27,7 @@ describe('useFilterState', () => { it('should return a setFilter function to update the filter value after a given debounceTime', async () => { const { hookValue, childrenMock } = renderHook(() => - useFilterState({ debounceTime: 10 }) + useFilterState({ debounceTime: 50 }) ); expect(hookValue.filter).toEqual({ q: '' }); @@ -35,7 +35,7 @@ describe('useFilterState', () => { act(() => hookValue.setFilter('needle in a haystack')); expect(childrenMock).toBeCalledTimes(1); - await new Promise(resolve => setTimeout(resolve, 11)); + await new Promise(resolve => setTimeout(resolve, 70)); expect(childrenMock).toBeCalledTimes(2); @@ -47,7 +47,7 @@ describe('useFilterState', () => { it('should provide setFilter to update filter value after given debounceTime preserving permanentFilter and filterToQuery', async () => { const { hookValue, childrenMock } = renderHook(() => useFilterState({ - debounceTime: 10, + debounceTime: 50, permanentFilter: { type: 'thisOne' }, filterToQuery: v => ({ search: v }), }) @@ -56,7 +56,7 @@ describe('useFilterState', () => { act(() => hookValue.setFilter('needle in a haystack')); expect(childrenMock).toBeCalledTimes(1); - await new Promise(resolve => setTimeout(resolve, 11)); + await new Promise(resolve => setTimeout(resolve, 70)); expect(childrenMock).toBeCalledTimes(2);