connected-react-router#onLocationChanged JavaScript Examples

The following examples show how to use connected-react-router#onLocationChanged. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: reducer.test.js    From bank-client with MIT License 6 votes vote down vote up
/* eslint-disable default-case, no-param-reassign */
describe('registerPageReducer', () => {
  let state;
  beforeEach(() => {
    state = {
      pinCode: '',
      password: '',
      currentStep: 0,
    };
  });

  it('should return the initial state', () => {
    const expectedResult = state;
    expect(loginPageReducer(undefined, {})).toEqual(expectedResult);
  });

  it('should handle the LocationChangeAction action correctly', () => {
    const expectedResult = produce(state, (draft) => {
      draft.password = state.password;
      draft.pinCode = state.pinCode;

      draft.currentStep = state.currentStep;
    });

    expect(loginPageReducer(state, onLocationChanged())).toEqual(
      expectedResult,
    );
  });
});