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({
1818 integrations,
1919} : {
2020 integrations : Record < string , boolean > ;
21- } ) {
22- return async ( url ) => {
21+ } ) : typeof globalThis . fetch {
22+ return ( url ) => {
2323 if ( typeof url !== 'string' ) {
2424 throw new Error ( 'Expected url to be a string' ) ;
2525 }
2626 if ( url . startsWith ( FAKE_HADRON_AUTO_UPDATE_ENDPOINT ) ) {
2727 if ( url === `${ FAKE_HADRON_AUTO_UPDATE_ENDPOINT } /api/v2/integrations` ) {
28- return {
28+ return Promise . resolve ( {
2929 ok : true ,
30- async json ( ) {
31- return integrations ;
30+ json ( ) {
31+ return Promise . resolve ( integrations ) ;
3232 } ,
33- } as Response ;
33+ } as Response ) ;
3434 }
3535 } else if ( url === 'https://widget.intercom.io/widget/appid123' ) {
3636 // NOTE: we use 301 since intercom will redirects
3737 // to the actual location of the widget script
38- return { status : 301 } as Response ;
38+ return Promise . resolve ( { status : 301 } as Response ) ;
3939 }
4040 throw new Error ( `Unexpected URL called on the fake update server: ${ url } ` ) ;
4141 } ;
You can’t perform that action at this time.
0 commit comments