Skip to content

Commit 6976a92

Browse files
test: updated to not test transient state
1 parent ec1c2a6 commit 6976a92

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

apps/meteor/client/components/Omnichannel/hooks/useUnitsList.spec.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,11 @@ it('should fetch business units', async () => {
3737

3838
const { result } = renderHook(() => useUnitsList({ filter: '', limit }), { wrapper: appRoot.build() });
3939

40-
expect(result.current.isFetching).toBe(true);
41-
await waitFor(() => expect(result.current.isFetching).toBe(false));
42-
43-
expect(mockGetUnits).toHaveBeenCalled();
44-
expect(result.current.data).toEqual(data.slice(0, 5).map(formatUnitItem));
40+
await waitFor(() => expect(result.current.data).toEqual(data.slice(0, 5).map(formatUnitItem)));
4541

4642
await act(() => result.current.fetchNextPage());
4743

48-
expect(mockGetUnits).toHaveBeenCalledTimes(2);
49-
await waitFor(() => expect(result.current.data).toHaveLength(10));
50-
expect(result.current.data).toEqual(data.map(formatUnitItem));
44+
await waitFor(() => expect(result.current.data).toEqual(data.map(formatUnitItem)));
5145

5246
await act(() => result.current.fetchNextPage());
5347

0 commit comments

Comments
 (0)