@@ -2,7 +2,6 @@ import { get, set, setProperties, defineProperty } from '@ember/object';
2
2
import { sendEvent } from '@ember/object/events' ;
3
3
import RSVP from 'rsvp' ;
4
4
import Service from '@ember/service' ;
5
- import fetch from 'fetch' ;
6
5
import { A } from '@ember/array' ;
7
6
import {
8
7
ApolloClient ,
@@ -14,10 +13,14 @@ import { isArray } from '@ember/array';
14
13
import { isNone , isPresent } from '@ember/utils' ;
15
14
import { run , next } from '@ember/runloop' ;
16
15
import { QueryManager } from '../index' ;
17
- import { waitForPromise } from '@ember/test-waiters' ;
16
+ import { waitForPromise , waitForFetch } from '@ember/test-waiters' ;
18
17
import { tracked } from '@glimmer/tracking' ;
19
18
import { macroCondition , isTesting } from '@embroider/macros' ;
20
19
20
+ export function wrappedFetch ( ...args ) {
21
+ return waitForFetch ( fetch ( ...args ) ) ;
22
+ }
23
+
21
24
const apolloObservableWeakMap = new WeakMap ( ) ;
22
25
const apolloUnsubscribeWeakMap = new WeakMap ( ) ;
23
26
@@ -151,7 +154,7 @@ export default class ApolloService extends Service {
151
154
152
155
link ( ) {
153
156
const { apiURL, requestCredentials } = this . options ;
154
- const linkOptions = { uri : apiURL , fetch } ;
157
+ const linkOptions = { uri : apiURL , fetch : wrappedFetch } ;
155
158
156
159
if ( isPresent ( requestCredentials ) ) {
157
160
linkOptions . credentials = requestCredentials ;
0 commit comments