How to use the redux-mock-store.default function in redux-mock-store

To help you get started, we’ve selected a few redux-mock-store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jolocom / smartwallet-app / tests / utils / createMockStore.ts View on Github external
export function createMockStore(
  initialState: RecursivePartial | ((actions: AnyAction[]) => RootState) = {},
  backendMiddlewareStub: RecursivePartial = {},
) {
  const mockBackendMiddleware = stub(backendMiddlewareStub)
  const mockStore = originalCreateMockStore([
    thunk.withExtraArgument(mockBackendMiddleware),
  ])(initialState as RootState) as MockStoreWithMockBackend

  mockStore.reset = () => {
    mockStore.clearActions()
    stub.clearMocks(mockBackendMiddleware)
  }

  mockStore.backendMiddleware = mockBackendMiddleware

  return mockStore
}
github brave / ethereum-remote-client / test / unit / ui / app / actions.spec.js View on Github external
const EthQuery = require('eth-query')
const Eth = require('ethjs')
const KeyringController = require('eth-keyring-controller')

const { createTestProviderTools } = require('../../../stub/provider')
const provider = createTestProviderTools({ scaffold: {}}).provider

const enLocale = require('../../../../app/_locales/en/messages.json')
const actions = require('../../../../ui/app/store/actions')
const MetaMaskController = require('../../../../app/scripts/metamask-controller')

const firstTimeState = require('../../../unit/localhostState')
const devState = require('../../../data/2-state.json')

const middleware = [thunk]
const mockStore = configureStore(middleware)

describe('Actions', () => {

  const noop = () => {}

  let background, metamaskController

  const TEST_SEED = 'debris dizzy just program just float decrease vacant alarm reduce speak stadium'
  const password = 'a-fake-password'
  const importPrivkey = '4cfd3e90fc78b0f86bf7524722150bb8da9c60cd532564d7ff43f5716514f553'

  beforeEach(async () => {


    metamaskController = new MetaMaskController({
      provider,

redux-mock-store

A mock store for testing your redux async action creators and middleware

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis

Similar packages