Skip to content

Actions without types throw an error rather than return the default state #140

@JaKXz

Description

@JaKXz

In my test setup code I have this line:

test.beforeEach(t => {
  const initialState = reducer();
});

where

const reducer = handleActions({ ... }, { /*initial state*/});

However, the first method throws an error because:
screen shot 2016-10-06 at 11 15 55 am

and in the transpiled source it looks like action.type.toString() is called unguardedly. Now, maybe I'm misunderstanding how FSAs work, but I think it makes sense for a reducer test to be able to check that the initial state is returned when the action type is missing. I can try to make a PR for this as well, if you think I'm correct about the expected behaviour.

If not, could you please fill me in on what I'm missing? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions