...

/

General Tests

General Tests

Learn to build general tests to test async middleware.

We'll cover the following...

The first test for any middleware is to ensure that it passes unknown actions down the chain. If we forget to use next(action), no actions will reach the reducers:

// Verifying unknown actions are handled correctly
it('should ignore non-API actions', () => {
  const sampleAction = { type: 'SAMPLE_ACTION' };

  middleware(sampleAction);

  // dispatch
...