Improve variable names

This commit is contained in:
Marcello Lamonaca 2021-03-24 17:21:04 +01:00
parent a2aec9fc3f
commit 990709787c

View file

@ -70,14 +70,14 @@ import reducer from "path/to/reducer";
import * as actions from "path/to/actionCreators"; import * as actions from "path/to/actionCreators";
it("test description", () => { it("test description", () => {
const initialState = /* satte before the action */; const initialState = /* state before the action */;
const stateUpdate = /* modified state */; const finalState = /* expected state after the action */
const data = /* data passed to the action creator */;
const action = actions.actionCreator(stateUpdate);
const action = actions.actionCreator(data);
const newState = reducer(initialState, action); const newState = reducer(initialState, action);
expect(newState.property).toEqual(actual); expect(newState).toEqual(finalState);
}); });
``` ```
@ -93,12 +93,14 @@ import * as actions from "path/to/actionCreators";
it("test description", () => { it("test description", () => {
const store = createStore(toorReducer, initialState); const store = createStore(toorReducer, initialState);
const stateUpdate = /* modified state */; const expectedState = /* state after the update */
const action = actions.actionCreator(stateUpdate);
const data = /* action creator input */;
const action = actions.actionCreator(data);
store.dispatch(action); store.dispatch(action);
const state = store.getState(); const state = store.getState();
expect(state).toEqual(stateUpdate); expect(state).toEqual(expectedState);
}); });
``` ```