Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Fix: Stabilize tests #3777

Merged
merged 1 commit into from
Oct 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/ra-core/src/controller/useFilterState.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ 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: '' });

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);

Expand All @@ -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 }),
})
Expand All @@ -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);

Expand Down