Fix useFetchRelationships tests
This commit is contained in:
parent
edbaf60009
commit
e83914482d
1 changed files with 12 additions and 12 deletions
|
@ -30,7 +30,7 @@ describe('useFetchRelationships()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('is successful', async() => {
|
it('is successful', async() => {
|
||||||
const { result } = renderHook(() => {
|
renderHook(() => {
|
||||||
const fetchRelationships = useFetchRelationships();
|
const fetchRelationships = useFetchRelationships();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -40,13 +40,13 @@ describe('useFetchRelationships()', () => {
|
||||||
return fetchRelationships;
|
return fetchRelationships;
|
||||||
}, undefined, store);
|
}, undefined, store);
|
||||||
|
|
||||||
await waitFor(() => expect(result.current.isLoading).toBe(false));
|
await waitFor(() => {
|
||||||
|
|
||||||
expect(store.getState().relationships.size).toBe(1);
|
expect(store.getState().relationships.size).toBe(1);
|
||||||
expect(store.getState().relationships.getIn([id, 'id'])).toBe(id);
|
expect(store.getState().relationships.getIn([id, 'id'])).toBe(id);
|
||||||
expect(store.getState().relationships.getIn([id, 'blocked_by'])).toBe(true);
|
expect(store.getState().relationships.getIn([id, 'blocked_by'])).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('with multiple relationships', () => {
|
describe('with multiple relationships', () => {
|
||||||
const ids = ['123', '456'];
|
const ids = ['123', '456'];
|
||||||
|
@ -60,7 +60,7 @@ describe('useFetchRelationships()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('is successful', async() => {
|
it('is successful', async() => {
|
||||||
const { result } = renderHook(() => {
|
renderHook(() => {
|
||||||
const fetchRelationships = useFetchRelationships();
|
const fetchRelationships = useFetchRelationships();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -70,14 +70,14 @@ describe('useFetchRelationships()', () => {
|
||||||
return fetchRelationships;
|
return fetchRelationships;
|
||||||
}, undefined, store);
|
}, undefined, store);
|
||||||
|
|
||||||
await waitFor(() => expect(result.current.isLoading).toBe(false));
|
await waitFor(() => {
|
||||||
|
|
||||||
expect(store.getState().relationships.size).toBe(2);
|
expect(store.getState().relationships.size).toBe(2);
|
||||||
expect(store.getState().relationships.getIn([ids[0], 'id'])).toBe(ids[0]);
|
expect(store.getState().relationships.getIn([ids[0], 'id'])).toBe(ids[0]);
|
||||||
expect(store.getState().relationships.getIn([ids[1], 'id'])).toBe(ids[1]);
|
expect(store.getState().relationships.getIn([ids[1], 'id'])).toBe(ids[1]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('with an unsuccessful query', () => {
|
describe('with an unsuccessful query', () => {
|
||||||
const id = '123';
|
const id = '123';
|
||||||
|
|
Loading…
Reference in a new issue