* Remove redux-offline and configure redux-persist * Fix typo * Fix configure store * Upgrade to redux-persist 6.0.0 * Add migration from redux-persist v4 to v6 * Replace AsyncStorage with MMKVStorage to boost storage speed * Mock RNFastStorage * Fix reactions test * Fix clearing the store on logout * Remove the need for LOGOUT_SUCCESS * No need to pass persistConfig to middlewares() * Remove unused imports * Export connection Accidentally removed this export. * Add batch action name Co-Authored-By: Elias Nahum <nahumhbl@gmail.com> * Add batch action name Co-Authored-By: Elias Nahum <nahumhbl@gmail.com> * Add batch action name Co-Authored-By: Elias Nahum <nahumhbl@gmail.com> * Add batch action name Co-Authored-By: Elias Nahum <nahumhbl@gmail.com> * Fix delete post * Fix leave channel Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
import {AsyncNodeStorage} from 'redux-persist-node-storage';
|
|
import {createTransform} from 'redux-persist';
|
|
|
|
import configureStore from '@mm-redux/store';
|
|
|
|
export default async function testConfigureStore(preloadedState) {
|
|
const storageTransform = createTransform(
|
|
() => ({}),
|
|
() => ({}),
|
|
);
|
|
|
|
const persistConfig = {
|
|
key: 'root',
|
|
storage: new AsyncNodeStorage('./.tmp'),
|
|
whitelist: [],
|
|
transforms: [
|
|
storageTransform,
|
|
],
|
|
};
|
|
|
|
const {store} = configureStore(preloadedState, {}, persistConfig, () => ({}), {enableBuffer: false});
|
|
|
|
const wait = () => new Promise((resolve) => setTimeout(resolve), 300); //eslint-disable-line
|
|
await wait();
|
|
|
|
return store;
|
|
}
|
|
|
|
// This should probably be replaced by redux-mock-store like the web app
|
|
export function mockDispatch(dispatch) {
|
|
const mocked = (action) => {
|
|
dispatch(action);
|
|
|
|
mocked.actions.push(action);
|
|
};
|
|
|
|
mocked.actions = [];
|
|
|
|
return mocked;
|
|
}
|