insomnia/packages/insomnia-app/app/__jest__/redux-state-for-test.ts

20 lines
736 B
TypeScript
Raw Normal View History

import { ACTIVITY_HOME } from '../common/constants';
import { BASE_PROJECT_ID } from '../models/project';
import { RootState } from '../ui/redux/modules';
2021-01-25 02:50:53 +00:00
import * as entities from '../ui/redux/modules/entities';
import { GlobalState } from '../ui/redux/modules/global';
2021-01-25 02:50:53 +00:00
export const reduxStateForTest = async (global: Partial<GlobalState> = {}): Promise<RootState> => ({
entities: entities.reducer(entities.initialEntitiesState, entities.initializeWith(await entities.allDocs())),
global: {
activeWorkspaceId: null,
activeActivity: ACTIVITY_HOME,
activeProjectId: BASE_PROJECT_ID,
dashboardSortOrder: 'modified-desc',
isLoading: false,
isLoggedIn: false,
loadingRequestIds: {},
...global,
},
2021-01-25 02:50:53 +00:00
});