Skip to content

Commit

Permalink
don't destructure Ember.testing
Browse files Browse the repository at this point in the history
Module destructures are evaluated at build time, but this value is
changed dynamically at runtime. Avoiding the destructure is the only way
to work given this behavior. See these issues:

mainmatter/ember-simple-auth#1476
emberjs/ember-test-helpers#227
  • Loading branch information
bgentry committed Dec 17, 2017
1 parent 4f62d4c commit 52d932f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions addon/services/apollo.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ import QueryManager from 'ember-apollo-client/apollo/query-manager';
import copyWithExtras from 'ember-apollo-client/utils/copy-with-extras';
import { registerWaiter } from '@ember/test';

const {
testing,
} = Ember;

function newDataFunc(observable, resultKey, resolve, mergedProps = {}) {
let obj;
mergedProps[apolloObservableKey] = observable;
Expand Down Expand Up @@ -70,7 +66,7 @@ export default Service.extend({
let config = getOwner(this).resolveRegistration("config:environment");
if (config && config.apollo) {
return config.apollo;
} else if (testing) {
} else if (Ember.testing) {
return defaultOptions;
}
throw new Error("no Apollo service options defined");
Expand All @@ -87,7 +83,7 @@ export default Service.extend({
let client = new ApolloClient(this.get('clientOptions'));
this.set('client', client);

if (testing) {
if (Ember.testing) {
this._registerWaiter();
}
},
Expand Down

0 comments on commit 52d932f

Please sign in to comment.