Fix tests

This commit is contained in:
Chewbacca 2023-03-08 14:11:40 -05:00
parent 7ad2696f85
commit bd4c99b697
2 changed files with 11 additions and 18 deletions

View file

@ -2,7 +2,7 @@ import { Map as ImmutableMap } from 'immutable';
import { __stub } from 'soapbox/api';
import { renderHook, waitFor } from 'soapbox/jest/test-helpers';
import { normalizeAccount, normalizeGroup, normalizeInstance } from 'soapbox/normalizers';
import { normalizeAccount, normalizeGroup, normalizeGroupRelationship, normalizeInstance } from 'soapbox/normalizers';
import { useGroupsPath } from '../useGroupsPath';
@ -58,23 +58,16 @@ describe('useGroupsPath()', () => {
id: '1',
}),
]);
mock.onGet('/api/v1/groups/relationships?id[]=1').reply(200, [
normalizeGroupRelationship({
id: '1',
}),
]);
});
});
test('should default to the discovery page', async () => {
const store = {
entities: {
Groups: {
store: {
'1': normalizeGroup({}),
},
lists: {
'': new Set(['1']),
},
},
},
};
test('should default to the "My Groups" page', async () => {
const { result } = renderHook(useGroupsPath, undefined, store);
await waitFor(() => {

View file

@ -104,7 +104,7 @@ const usePopularGroups = () => {
const { fetchGroups } = useGroupsApi();
const getQuery = async () => {
const { groups } = await fetchGroups('/api/v1/groups/search?q=group'); // '/api/v1/truth/trends/groups'
const { groups } = await fetchGroups('/api/v1/truth/trends/groups');
return groups;
};
@ -125,7 +125,7 @@ const useSuggestedGroups = () => {
const { fetchGroups } = useGroupsApi();
const getQuery = async () => {
const { groups } = await fetchGroups('/api/v1/groups/search?q=group'); // /api/v1/truth/suggestions/groups
const { groups } = await fetchGroups('/api/v1/truth/suggestions/groups');
return groups;
};
@ -146,7 +146,7 @@ const useGroup = (id: string) => {
const { fetchGroups } = useGroupsApi();
const getGroup = async () => {
const { groups } = await fetchGroups(`/api/v1/groups/${id}`); // /api/v1/truth/suggestions/groups
const { groups } = await fetchGroups(`/api/v1/groups/${id}`);
return groups[0];
};