Skip to content

Unit Testing with new features from 6.2.0 #21

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

Conversation

SethDavenport
Copy link
Member

Work in progress.

@SethDavenport SethDavenport changed the title Initial work to improve ngRedux unit testing. [WIP] Initial work to improve ngRedux unit testing. Mar 12, 2017
@SethDavenport
Copy link
Member Author

@e-schultz @Bronzovik related to our discussion from the other day about making it easier to mock NgRedux/store for unit testing.

The idea would be to move the NgReduxTestingModule currently in the testing folder into @angular-redux/store itself; I'm just proving it out in the example app currently.

This way, you just add NgReduxTestingModule to your TestBed imports, and it gives you properly set-up mocks for NgRedux and DevToolsExtension, which work for @select components as well.

Then you can either

  • spy on select/@select and dispatch using MockNgRedux.spyOnSelect/MockNgRedux.spyOnDispatch(which return Jasmine Spies)
  • or set up stubs for specific select calls using MockNgRedux.registerSelection('foo', ['mock', 'foo', 'value', 'stream'])

@DroneKid
Copy link

Looks great!

@SethDavenport SethDavenport force-pushed the chore/unit-test-all-the-things branch from f9a2fc1 to 28fb26d Compare April 22, 2017 18:18
@SethDavenport SethDavenport changed the title [WIP] Initial work to improve ngRedux unit testing. Unit Testing with new features from 6.2.0 Apr 25, 2017
@SethDavenport SethDavenport merged commit be25c23 into angular-redux:master Apr 25, 2017
@SethDavenport SethDavenport deleted the chore/unit-test-all-the-things branch April 25, 2017 22:31
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