Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
}
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,