File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
packages/compass-intercom/src Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -18,24 +18,24 @@ function createMockFetch({
18
18
integrations,
19
19
} : {
20
20
integrations : Record < string , boolean > ;
21
- } ) {
22
- return async ( url ) => {
21
+ } ) : typeof globalThis . fetch {
22
+ return ( url ) => {
23
23
if ( typeof url !== 'string' ) {
24
24
throw new Error ( 'Expected url to be a string' ) ;
25
25
}
26
26
if ( url . startsWith ( FAKE_HADRON_AUTO_UPDATE_ENDPOINT ) ) {
27
27
if ( url === `${ FAKE_HADRON_AUTO_UPDATE_ENDPOINT } /api/v2/integrations` ) {
28
- return {
28
+ return Promise . resolve ( {
29
29
ok : true ,
30
- async json ( ) {
31
- return integrations ;
30
+ json ( ) {
31
+ return Promise . resolve ( integrations ) ;
32
32
} ,
33
- } as Response ;
33
+ } as Response ) ;
34
34
}
35
35
} else if ( url === 'https://widget.intercom.io/widget/appid123' ) {
36
36
// NOTE: we use 301 since intercom will redirects
37
37
// to the actual location of the widget script
38
- return { status : 301 } as Response ;
38
+ return Promise . resolve ( { status : 301 } as Response ) ;
39
39
}
40
40
throw new Error ( `Unexpected URL called on the fake update server: ${ url } ` ) ;
41
41
} ;
You can’t perform that action at this time.
0 commit comments