mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 17:58:07 +00:00
Merge pull request #16986 from strapi/fix/use-enterprise-tests
test: remove erroneous act calls
This commit is contained in:
commit
9d554ec9aa
@ -1,4 +1,4 @@
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { renderHook, waitFor } from '@testing-library/react';
|
||||
|
||||
import { useEnterprise } from '../useEnterprise';
|
||||
|
||||
@ -29,11 +29,9 @@ describe('useEnterprise (EE)', () => {
|
||||
test('Returns default data on first render and EE data on second', async () => {
|
||||
const { result } = setup(CE_DATA_FIXTURE, async () => EE_DATA_FIXTURE);
|
||||
|
||||
await act(async () => {
|
||||
expect(result.current).toBe(null);
|
||||
});
|
||||
expect(result.current).toBe(null);
|
||||
|
||||
expect(result.current).toBe(EE_DATA_FIXTURE);
|
||||
await waitFor(() => expect(result.current).toBe(EE_DATA_FIXTURE));
|
||||
});
|
||||
|
||||
test('Combines CE and EE data', async () => {
|
||||
@ -43,30 +41,26 @@ describe('useEnterprise (EE)', () => {
|
||||
},
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
expect(result.current).toBe(null);
|
||||
});
|
||||
expect(result.current).toBe(null);
|
||||
|
||||
expect(result.current).toStrictEqual([...CE_DATA_FIXTURE, ...EE_DATA_FIXTURE]);
|
||||
await waitFor(() =>
|
||||
expect(result.current).toStrictEqual([...CE_DATA_FIXTURE, ...EE_DATA_FIXTURE])
|
||||
);
|
||||
});
|
||||
|
||||
test('Returns EE data without custom combine', async () => {
|
||||
const { result } = setup(CE_DATA_FIXTURE, async () => EE_DATA_FIXTURE);
|
||||
|
||||
await act(async () => {});
|
||||
|
||||
await act(async () => {
|
||||
expect(result.current).toStrictEqual(EE_DATA_FIXTURE);
|
||||
});
|
||||
await waitFor(() => expect(result.current).toStrictEqual(EE_DATA_FIXTURE));
|
||||
});
|
||||
|
||||
test('Returns a custom defaultValue on first render', async () => {
|
||||
test('Returns a custom defaultValue on first render followed by the EE data', async () => {
|
||||
const { result } = setup(CE_DATA_FIXTURE, async () => EE_DATA_FIXTURE, {
|
||||
defaultValue: false,
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
expect(result.current).toBe(false);
|
||||
});
|
||||
expect(result.current).toBe(false);
|
||||
|
||||
await waitFor(() => expect(result.current).toStrictEqual(EE_DATA_FIXTURE));
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user