1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +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;