Skip to content

Unit test all the things

Choose a tag to compare

@poteto poteto released this 07 Jul 17:05
· 246 commits to master since this release

This bugfix release fixes an issue where injecting the service into a unit test via needs: [ 'service:flash-messages' ] would break due to the way the addon was naming its files.

For unit tests that require the flashMessages service, you'll need to do a small bit of setup:

moduleFor('route:foo', 'Unit | Route | foo', {
  needs: [ 'service:flash-messages' ],
  beforeEach() {
    const typesUsed = [ 'warning', 'success' ];
    this.container.lookup('service:flash-messages').registerTypes(typesUsed);
  }
});

If you're only using the add method to add flash messages, you can skip this step.

Go forth and test your Ember apps!