insomnia/packages/insomnia-app/app/__jest__/redux-state-for-test.ts
Opender Singh 7397370f4b
Use activateWorkspace action to activate a workspace (#3856)
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
2021-07-29 04:55:31 +00:00

19 lines
687 B
TypeScript

import { ACTIVITY_HOME } from '../common/constants';
import { BASE_SPACE_ID } from '../models/space';
import { RootState } from '../ui/redux/modules';
import * as entities from '../ui/redux/modules/entities';
import { GlobalState } from '../ui/redux/modules/global';
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,
activeSpaceId: BASE_SPACE_ID,
isLoading: false,
isLoggedIn: false,
loadingRequestIds: {},
...global,
},
});