@@ -456,7 +456,7 @@ describe('Instance attachments: binary output', () => {
456
456
457
457
const { scenario, uploads } = await initDistinctFileNamesScenario ( {
458
458
fileNameFactory : ( { nodeId, basename, extension } ) => {
459
- return `${ basename } -${ stripNodeIDPrefix ( nodeId ) } ${ extension } ` ;
459
+ return `${ basename } -${ stripNodeIDPrefix ( nodeId ) } ${ extension ?? '' } ` ;
460
460
} ,
461
461
} ) ;
462
462
@@ -513,18 +513,24 @@ describe('Instance attachments: binary output', () => {
513
513
} ) ;
514
514
515
515
it ( 'populates metadata about when the file was written' , async ( ) => {
516
- const unixTime = ( date : Date ) : number => date . getSeconds ( ) ;
516
+ const timestampedFileName = (
517
+ basename : string ,
518
+ extension : string | null ,
519
+ writtenAt : Date
520
+ ) : string => {
521
+ return `${ basename } -${ writtenAt . getTime ( ) } ${ extension ?? '' } ` ;
522
+ } ;
517
523
518
524
const { scenario, uploads } = await initDistinctFileNamesScenario ( {
519
525
fileNameFactory : ( { writtenAt, basename, extension } ) => {
520
- return ` ${ basename } - ${ unixTime ( writtenAt ) } ${ extension } ` ;
526
+ return timestampedFileName ( basename , extension , writtenAt ) ;
521
527
} ,
522
528
} ) ;
523
529
524
530
const expectedFileName = ( index : 0 | 1 | 2 | 3 ) : string => {
525
531
const { uploadedAt } = uploads [ index ] ;
526
532
527
- return ` ${ INDISTINGUISHABLE_BASE_NAME } - ${ unixTime ( uploadedAt ) } .txt` ;
533
+ return timestampedFileName ( INDISTINGUISHABLE_BASE_NAME , ' .txt' , uploadedAt ) ;
528
534
} ;
529
535
530
536
const expectedFileNames = [
0 commit comments