1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/packages/app-mobile/utils/testing/createMockReduxStore.ts

19 lines
511 B
TypeScript

import reducer from '@joplin/lib/reducer';
import { createStore } from 'redux';
import appDefaultState from '../appDefaultState';
import Setting from '@joplin/lib/models/Setting';
import { AppState } from '../types';
const testReducer = (state: AppState|undefined, action: unknown) => {
state ??= {
...appDefaultState,
settings: Setting.toPlainObject(),
};
return reducer(state, action);
};
const createMockReduxStore = () => {
return createStore(testReducer);
};
export default createMockReduxStore;