import defaultsDeep from 'lodash-es/defaultsDeep';

import { buildRootReducer, RootState } from 'mweb/common/reducers/root';

export type RootStateDeepPartial = DeepPartial<RootState>;

export function createTestState(opts: RootStateDeepPartial = {}): RootState {
  return defaultsDeep(
    opts,
    buildRootReducer()(undefined, { type: 'NOOP' }),
  ) as RootState;
}

export default createTestState;
