File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import {
1111import { uploadFile } from '../../utils/uploads.js'
1212import { jest } from '@jest/globals'
1313import { v4 } from 'uuid'
14+ import { downloadService } from '../../../src/services/download/index.js'
15+ import { Readable } from 'stream'
1416
1517describe ( 'Object' , ( ) => {
1618 let user : UserWithOrganization
@@ -65,9 +67,18 @@ describe('Object', () => {
6567 } )
6668
6769 it ( 'isArchived should return true for archived object' , async ( ) => {
70+ const downloadSpy = jest . spyOn ( downloadService , 'download' )
71+ downloadSpy . mockResolvedValueOnce (
72+ new Readable ( {
73+ read : async function ( ) {
74+ this . push ( null )
75+ } ,
76+ } ) ,
77+ )
6878 await ObjectUseCases . onObjectArchived ( fileCid )
6979 const isArchived = await ObjectUseCases . isArchived ( fileCid )
7080 expect ( isArchived ) . toBe ( true )
81+ expect ( downloadSpy ) . toHaveBeenCalledTimes ( 1 )
7182 } )
7283
7384 it ( 'should get listed in user objects' , async ( ) => {
Original file line number Diff line number Diff line change @@ -327,6 +327,7 @@ const populateCaches = async (cid: string) => {
327327 logger . warn (
328328 `Failed to download object (cid=${ cid } ) from DB after archival check: ${ e } ` ,
329329 )
330+ throw e
330331 } )
331332}
332333
You can’t perform that action at this time.
0 commit comments