Skip to content

Commit

Permalink
test: Wait for hook mutation (#35025)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored Jan 24, 2025
1 parent 483cb99 commit 492eba9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 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,8 +40,8 @@ describe('usePruneWarningMessage hook', () => {
}),
});
expect(result.current).toEqual('a minute June 1, 2024 at 12:30 AM');
jest.advanceTimersByTime(31 * 60 * 1000);
expect(result.current).toEqual('a minute June 1, 2024 at 1:00 AM');
await jest.advanceTimersByTimeAsync(31 * 60 * 1000);
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 492eba9

Please sign in to comment.