Fix useGroupLookup test

This commit is contained in:
Alex Gleason 2023-07-06 11:14:34 -05:00
parent 6f83b7748e
commit 39eb76bc18
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -1,10 +1,11 @@
import { __stub } from 'soapbox/api';
import { buildGroup } from 'soapbox/jest/factory';
import { renderHook, waitFor } from 'soapbox/jest/test-helpers';
import { renderHook, rootState, waitFor } from 'soapbox/jest/test-helpers';
import { useGroupLookup } from '../useGroupLookup';
const group = buildGroup({ id: '1', slug: 'soapbox' });
const state = rootState.setIn(['instance', 'version'], '3.4.1 (compatible; TruthSocial 1.0.0)');
describe('useGroupLookup hook', () => {
describe('with a successful request', () => {
@ -15,7 +16,7 @@ describe('useGroupLookup hook', () => {
});
it('is successful', async () => {
const { result } = renderHook(() => useGroupLookup(group.slug));
const { result } = renderHook(() => useGroupLookup(group.slug), undefined, state);
await waitFor(() => expect(result.current.isFetching).toBe(false));
@ -31,7 +32,7 @@ describe('useGroupLookup hook', () => {
});
it('is has error state', async() => {
const { result } = renderHook(() => useGroupLookup(group.slug));
const { result } = renderHook(() => useGroupLookup(group.slug), undefined, state);
await waitFor(() => expect(result.current.isFetching).toBe(false));