2024-04-15 19:17:34 +02:00
|
|
|
import reducer from '@joplin/lib/reducer';
|
|
|
|
import { createStore } from 'redux';
|
|
|
|
import appDefaultState from '../appDefaultState';
|
|
|
|
import Setting from '@joplin/lib/models/Setting';
|
2024-12-11 14:31:05 +02:00
|
|
|
import { AppState } from '../types';
|
2024-04-15 19:17:34 +02:00
|
|
|
|
2024-12-11 14:31:05 +02:00
|
|
|
const testReducer = (state: AppState|undefined, action: unknown) => {
|
|
|
|
state ??= {
|
|
|
|
...appDefaultState,
|
|
|
|
settings: Setting.toPlainObject(),
|
|
|
|
};
|
2024-04-15 19:17:34 +02:00
|
|
|
return reducer(state, action);
|
|
|
|
};
|
|
|
|
|
|
|
|
const createMockReduxStore = () => {
|
|
|
|
return createStore(testReducer);
|
|
|
|
};
|
|
|
|
export default createMockReduxStore;
|