@@ -289,7 +289,7 @@ describe("Session", () => {
289289 } ) ;
290290 } ) ;
291291
292- it ( "Should support abort of uploading file" , async ( ) => {
292+ it ( "Should support abort of uploading file using xhr " , async ( ) => {
293293 const data = { foo : "bar" } ;
294294 const blob = new Blob ( [ JSON . stringify ( data ) ] , {
295295 type : "application/json" ,
@@ -313,6 +313,30 @@ describe("Session", () => {
313313 await expect ( promise ) . resolves . toEqual ( true ) ;
314314 } ) ;
315315
316+ it ( "Should support abort of uploading file using signal" , async ( ) => {
317+ const data = { foo : "bar" } ;
318+ const blob = new Blob ( [ JSON . stringify ( data ) ] , {
319+ type : "application/json" ,
320+ } ) ;
321+
322+ const controller = new AbortController ( ) ;
323+ const promise = new Promise ( ( resolve ) => {
324+ const onAborted = ( ) => {
325+ resolve ( true ) ;
326+ } ;
327+
328+ session . createComponent ( blob , {
329+ signal : controller . signal ,
330+ name : "data.json" ,
331+ onProgress : ( ) => {
332+ controller . abort ( ) ;
333+ } ,
334+ onAborted,
335+ } ) ;
336+ } ) ;
337+ await expect ( promise ) . resolves . toEqual ( true ) ;
338+ } ) ;
339+
316340 it . skip ( "Should support ensure with create" , async ( ) => {
317341 const identifyingKeys = [ "key" , "parent_id" , "parent_type" ] ;
318342 const key = uuidV4 ( ) ;
0 commit comments