Comments (4)
How do you use mockStore
then? Do you pass an initial state?
from redux-mock-store.
@brotzky did you find a solution to this issue
from redux-mock-store.
@Descartess It's possible, but I've completely forgotten if I did. Sorry :(
from redux-mock-store.
Sorry to open this, but this is happening to me now.
Practically the same config as @brotzky
Part of one of my tests:
import React from 'react';
import { shallow } from 'enzyme/build';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import Trucks from '../.';
describe('Trucks', () => {
const initialState = {
trucks: {
loading: false,
trucks: [],
truck: {}
},
global: { accountName: 'Juaniten' }
};
const props = {
match: { params: { accountID: 1 } }
}
const middlewares = [ thunk ];
const mockStore = configureStore(middlewares);
let store;
let wrapper;
let component;
beforeEach(() => {
store = mockStore(initialState);
store.dispatch = jest.fn().mockName('mockDispatch');
component = shallow(<Trucks store={store} {...props} />);
wrapper = component.dive().dive();
});
If I remove the logger in the createStore
of the app, the test stop showing those logs on the console.
Thanks!
from redux-mock-store.
Related Issues (20)
- Actions dispatched after using Promise.all don't save to store HOT 2
- Configuring store for all React tests HOT 1
- Cannot read property 'enqueueForceUpdate' of undefined
- Docs link is not working the NPM repo HOT 3
- Testing nested actions HOT 2
- Test with extra dispatched action in middleware
- update url's in package.json to point to latest location HOT 2
- What is in 1.5.4? HOT 1
- Issue with Store Helpers HOT 1
- The Documentation is wrong for CommonJS HOT 1
- does not work with nested async thunks? HOT 4
- Version 1.5.4? HOT 5
- [Redux-toolkit] [createEntityAdapter] Cannot read property 'ids' of undefined HOT 1
- getActions method doesn't log correct actions
- Usage with createAsyncThunk - 'await' has no effect on the type of this expression. HOT 1
- clearActions method isn't working as expected
- ESM problem with default export
- Add note that this is no longer recommended or maintained?
- redux-mock-store throws error after updating jest to latest versions
- redux cannot read the property ids of undefined do you know why?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-mock-store.