| 24 | |
| 25 | // TODO remove non-serializable streamAborter, causes headaches |
| 26 | export const getEmptyRootState: () => RootState = () => { |
| 27 | const withoutSession: Omit<RootState, "session"> = { |
| 28 | config: INITIAL_CONFIG_SLICE, |
| 29 | ui: DEFAULT_UI_SLICE, |
| 30 | editModeState: INITIAL_EDIT_STATE, |
| 31 | indexing: INITIAL_INDEXING_STATE, |
| 32 | profiles: INITIAL_PROFILES_STATE, |
| 33 | tabs: INITIAL_TABS_STATE, |
| 34 | }; |
| 35 | const { streamAborter, ...serializableSession } = INITIAL_SESSION_STATE; |
| 36 | const sessionCopy = copyOf(serializableSession) as Omit< |
| 37 | RootState["session"], |
| 38 | "streamAborter" |
| 39 | >; |
| 40 | const withoutSessionCopy = copyOf(withoutSession) as Omit< |
| 41 | RootState, |
| 42 | "session" |
| 43 | >; |
| 44 | return { |
| 45 | ...withoutSessionCopy, |
| 46 | session: { |
| 47 | ...sessionCopy, |
| 48 | streamAborter: new AbortController(), |
| 49 | }, |
| 50 | }; |
| 51 | }; |
| 52 | |
| 53 | export const createMockStore = ( |
| 54 | initialState?: Partial<RootState>, |