Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subscribe to throw when listener is not a function #1325

Merged
merged 5 commits into from
Jan 30, 2016

Conversation

JamieDixon
Copy link
Contributor

Fixes: #1324


expect(() =>
store.subscribe()
).toThrow()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's check a few more data types: null, undefined, and string should throw.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few extra checks for the types mentioned. I've gone with the assertion style I've seen elsewhere rather than something like:

const cases = [undefined, null, ''];
    cases.map(arg =>
      expect(() =>
        store.subscribe(arg))
      .toThrow())


expect(() =>
store.subscribe(undefined)
).toThrow()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: please remove the extra newline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 removed in latest commit.

gaearon added a commit that referenced this pull request Jan 30, 2016
subscribe to throw when listener is not a function
@gaearon gaearon merged commit d98c3f0 into reduxjs:master Jan 30, 2016
@gaearon
Copy link
Contributor

gaearon commented Jan 31, 2016

Out in 3.1.6, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants