insomnia/packages/insomnia-app/app/__jest__/redux-state-for-test.ts
Dimitri Mitropoulos 7f7b9f5614
renames base project to default project in code and copy (#3939)
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-08-25 12:51:40 +12:00

20 lines
742 B
TypeScript

import { ACTIVITY_HOME } from '../common/constants';
import { DEFAULT_PROJECT_ID } from '../models/project';
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,
activeProjectId: DEFAULT_PROJECT_ID,
dashboardSortOrder: 'modified-desc',
isLoading: false,
isLoggedIn: false,
loadingRequestIds: {},
...global,
},
});