Skip to content

Commit

Permalink
Wait for hook mutation in test
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Jan 23, 2025
1 parent 721579c commit 626ba84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/meteor/client/hooks/usePruneWarningMessage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IRoomWithRetentionPolicy } from '@rocket.chat/core-typings';
import { renderHook } from '@testing-library/react';
import { renderHook, waitFor } from '@testing-library/react';

import { usePruneWarningMessage } from './usePruneWarningMessage';
import { createRenteionPolicySettingsMock as createMock } from '../../tests/mocks/client/mockRetentionPolicySettings';
Expand Down Expand Up @@ -40,7 +40,7 @@ describe('usePruneWarningMessage hook', () => {
});
expect(result.current).toEqual('a minute June 1, 2024 at 12:30 AM');
await jest.advanceTimersByTimeAsync(31 * 60 * 1000);
expect(result.current).toEqual('a minute June 1, 2024 at 1:00 AM');
await waitFor(() => expect(result.current).toEqual('a minute June 1, 2024 at 1:00 AM'));
});

it('Should return the default warning with precision set to every_hour', () => {
Expand Down

0 comments on commit 626ba84

Please sign in to comment.