11import js from '../resources/extensions/JsExtension.js' ;
22import nock from 'nock' ;
3- import request from 'got' ;
43import testHelpers from '../helpers/testHelpers.js' ;
54import { ActivityError } from '../../src/error/Errors.js' ;
65import { Scripts } from '../helpers/JavaScripts.js' ;
@@ -194,9 +193,9 @@ describe('ScriptTask', () => {
194193 <scriptTask id="scriptTask" scriptFormat="Javascript">
195194 <script>
196195 <![CDATA[
197- const request = environment.getServiceByName('request ');
198- request ('http://example.com/test')
199- .json()
196+ const fetch = environment.getServiceByName('fetch ');
197+ fetch ('http://example.com/test')
198+ .then((res) => res. json() )
200199 .then((body) => next(null, body))
201200 .catch(next);
202201 ]]>
@@ -208,18 +207,10 @@ describe('ScriptTask', () => {
208207 </process>
209208 </definitions>` ;
210209
211- nock ( 'http://example.com' ) . get ( '/test' ) . reply (
212- 200 ,
213- {
214- data : 2 ,
215- } ,
216- {
217- 'content-type' : 'application/json' ,
218- }
219- ) ;
210+ nock ( 'http://example.com' ) . get ( '/test' ) . reply ( 200 , { data : 2 } , { 'content-type' : 'application/json' } ) ;
220211
221212 const context = await testHelpers . context ( source ) ;
222- context . environment . addService ( 'request ' , request ) ;
213+ context . environment . addService ( 'fetch ' , globalThis . fetch ) ;
223214
224215 const task = context . getActivityById ( 'scriptTask' ) ;
225216 task . activate ( ) ;
0 commit comments