I need to include the media service in my application controller unit test. However, as a unit test it doesn't get an application and so the breakpoints module isn't available (which took me about a day to realize). That's my bad. The solution was to also include 'breakpoints:main' in needs.
However, the error message is, as you might guess from the day-long diagnosis, not so helpful. Here's the problematic part:
// from tests/helpers/responsive.js
_breakpointArr: Ember.computed('breakpoints', function() {
return Object.keys(this.get('breakpoints')) || Ember.A([]);
}),
I'm not entirely sure what the intention is or I'd submit a pull request.
First, I'd throw a more meaningful error if isBlank(this.get('breakpoints')), perhaps wondering if it's being included in a unit test and suggesting my fix above.
Second, I wonder what circumstances would allow the second half of the || to be reached. Even if it is, Object.keys wouldn't have returned an Ember.A, would it? So why the Ember.A here?
Thanks for taking a look.
I need to include the media service in my application controller unit test. However, as a unit test it doesn't get an application and so the breakpoints module isn't available (which took me about a day to realize). That's my bad. The solution was to also include
'breakpoints:main'in needs.However, the error message is, as you might guess from the day-long diagnosis, not so helpful. Here's the problematic part:
I'm not entirely sure what the intention is or I'd submit a pull request.
First, I'd throw a more meaningful error if
isBlank(this.get('breakpoints')), perhaps wondering if it's being included in a unit test and suggesting my fix above.Second, I wonder what circumstances would allow the second half of the
||to be reached. Even if it is, Object.keys wouldn't have returned an Ember.A, would it? So why the Ember.A here?Thanks for taking a look.