@@ -390,27 +390,27 @@ describe('sendEmail', () => {
390390 await expect ( start ( ) ) . resolves . toBeUndefined ( ) ;
391391
392392 const { IEXEC_OUT } = process . env ;
393- const resultTxt = await fsPromises . readFile (
394- path . join ( IEXEC_OUT , 'result.txt ' ) ,
393+ const resultJson = await fsPromises . readFile (
394+ path . join ( IEXEC_OUT , 'result.json ' ) ,
395395 'utf-8'
396396 ) ;
397397 const computedJson = await fsPromises . readFile (
398398 path . join ( IEXEC_OUT , 'computed.json' ) ,
399399 'utf-8'
400400 ) ;
401- expect ( JSON . parse ( resultTxt ) ) . toStrictEqual ( {
401+ expect ( JSON . parse ( resultJson ) ) . toStrictEqual ( {
402402 message : 'Your email has been sent successfully.' ,
403403 status : 200 ,
404404 } ) ;
405405 if ( requesterSecret . useCallback ) {
406406 expect ( JSON . parse ( computedJson ) ) . toStrictEqual ( {
407407 'callback-data' :
408408 '0x0000000000000000000000000000000000000000000000000000000000000001' ,
409- 'deterministic-output-path' : `${ IEXEC_OUT } /result.txt ` ,
409+ 'deterministic-output-path' : `${ IEXEC_OUT } /result.json ` ,
410410 } ) ;
411411 } else {
412412 expect ( JSON . parse ( computedJson ) ) . toStrictEqual ( {
413- 'deterministic-output-path' : `${ IEXEC_OUT } /result.txt ` ,
413+ 'deterministic-output-path' : `${ IEXEC_OUT } /result.json ` ,
414414 } ) ;
415415 }
416416 // output should not contain extra files
@@ -478,17 +478,17 @@ describe('sendEmail', () => {
478478
479479 // Check that bulk processing was attempted and completed
480480 const { IEXEC_OUT } = process . env ;
481- const resultTxt = await fsPromises . readFile (
482- path . join ( IEXEC_OUT , 'result.txt ' ) ,
481+ const resultJson = await fsPromises . readFile (
482+ path . join ( IEXEC_OUT , 'result.json ' ) ,
483483 'utf-8'
484484 ) ;
485- const result = JSON . parse ( resultTxt ) ;
485+ const result = JSON . parse ( resultJson ) ;
486486
487- expect ( result ) . toHaveProperty ( 'total-processed ' , 2 ) ;
487+ expect ( result ) . toHaveProperty ( 'total-count ' , 2 ) ;
488488 expect ( result ) . toHaveProperty ( 'success-count' ) ;
489489 expect ( result ) . toHaveProperty ( 'error-count' ) ;
490- expect ( result ) . toHaveProperty ( 'protected-data- results' ) ;
491- expect ( result [ 'protected-data- results' ] ) . toHaveLength ( 2 ) ;
490+ expect ( result ) . toHaveProperty ( 'results' ) ;
491+ expect ( result . results ) . toHaveLength ( 2 ) ;
492492 } ) ;
493493
494494 it ( 'should handle mixed valid and invalid datasets' , async ( ) => {
@@ -499,20 +499,20 @@ describe('sendEmail', () => {
499499 await expect ( start ( ) ) . resolves . toBeUndefined ( ) ;
500500
501501 const { IEXEC_OUT } = process . env ;
502- const resultTxt = await fsPromises . readFile (
503- path . join ( IEXEC_OUT , 'result.txt ' ) ,
502+ const resultJson = await fsPromises . readFile (
503+ path . join ( IEXEC_OUT , 'result.json ' ) ,
504504 'utf-8'
505505 ) ;
506- const result = JSON . parse ( resultTxt ) ;
506+ const result = JSON . parse ( resultJson ) ;
507507
508- expect ( result ) . toHaveProperty ( 'total-processed ' , 2 ) ;
509- expect ( result [ 'protected-data- results' ] ) . toHaveLength ( 2 ) ;
508+ expect ( result ) . toHaveProperty ( 'total-count ' , 2 ) ;
509+ expect ( result . results ) . toHaveLength ( 2 ) ;
510510
511511 // Should have both successes and errors
512- const successResults = result [ 'protected-data- results' ] . filter (
512+ const successResults = result . results . filter (
513513 ( r ) => r . response . status === 200
514514 ) ;
515- const errorResults = result [ 'protected-data- results' ] . filter (
515+ const errorResults = result . results . filter (
516516 ( r ) => r . response . status !== 200
517517 ) ;
518518
@@ -591,31 +591,30 @@ describe('sendEmail', () => {
591591 await expect ( start ( ) ) . resolves . toBeUndefined ( ) ;
592592
593593 const { IEXEC_OUT } = process . env ;
594- const resultTxt = await fsPromises . readFile (
595- path . join ( IEXEC_OUT , 'result.txt ' ) ,
594+ const resultJson = await fsPromises . readFile (
595+ path . join ( IEXEC_OUT , 'result.json ' ) ,
596596 'utf-8'
597597 ) ;
598598 const computedJson = await fsPromises . readFile (
599599 path . join ( IEXEC_OUT , 'computed.json' ) ,
600600 'utf-8'
601601 ) ;
602602
603- const result = JSON . parse ( resultTxt ) ;
603+ const result = JSON . parse ( resultJson ) ;
604604 const computed = JSON . parse ( computedJson ) ;
605605
606606 // Verify bulk processing result structure
607607 expect ( result ) . toHaveProperty ( 'message' ) ;
608- expect ( result ) . toHaveProperty ( 'status' , 200 ) ;
609- expect ( result ) . toHaveProperty ( 'total-processed' , 2 ) ;
608+ expect ( result ) . toHaveProperty ( 'total-count' , 2 ) ;
610609 expect ( result ) . toHaveProperty ( 'success-count' , 2 ) ;
611610 expect ( result ) . toHaveProperty ( 'error-count' , 0 ) ;
612- expect ( result ) . toHaveProperty ( 'protected-data- results' ) ;
613- expect ( result [ 'protected-data- results' ] ) . toHaveLength ( 2 ) ;
611+ expect ( result ) . toHaveProperty ( 'results' ) ;
612+ expect ( result . results ) . toHaveLength ( 2 ) ;
614613
615614 // Verify each protected data result
616- result [ 'protected-data- results' ] . forEach ( ( datasetResult , index ) => {
615+ result . results . forEach ( ( datasetResult , index ) => {
617616 expect ( datasetResult ) . toHaveProperty ( 'index' , index + 1 ) ;
618- expect ( datasetResult ) . toHaveProperty ( 'protectedData ' ) ;
617+ expect ( datasetResult ) . toHaveProperty ( 'protected-data ' ) ;
619618 expect ( datasetResult ) . toHaveProperty ( 'response' ) ;
620619 expect ( datasetResult . response ) . toHaveProperty ( 'status' , 200 ) ;
621620 expect ( datasetResult . response ) . toHaveProperty ( 'message' ) ;
@@ -624,13 +623,13 @@ describe('sendEmail', () => {
624623 // Verify computed.json structure
625624 expect ( computed ) . toHaveProperty ( 'deterministic-output-path' ) ;
626625 expect ( computed [ 'deterministic-output-path' ] ) . toBe (
627- `${ IEXEC_OUT } /result.txt `
626+ `${ IEXEC_OUT } /result.json `
628627 ) ;
629628
630629 // Verify no extra files were created
631630 const out = await fsPromises . readdir ( IEXEC_OUT ) ;
632631 expect ( out . length ) . toBe ( 2 ) ;
633- expect ( out ) . toContain ( 'result.txt ' ) ;
632+ expect ( out ) . toContain ( 'result.json ' ) ;
634633 expect ( out ) . toContain ( 'computed.json' ) ;
635634 } ) ;
636635
@@ -641,16 +640,16 @@ describe('sendEmail', () => {
641640 await expect ( start ( ) ) . resolves . toBeUndefined ( ) ;
642641
643642 const { IEXEC_OUT } = process . env ;
644- const resultTxt = await fsPromises . readFile (
645- path . join ( IEXEC_OUT , 'result.txt ' ) ,
643+ const resultJson = await fsPromises . readFile (
644+ path . join ( IEXEC_OUT , 'result.json ' ) ,
646645 'utf-8'
647646 ) ;
648647 const computedJson = await fsPromises . readFile (
649648 path . join ( IEXEC_OUT , 'computed.json' ) ,
650649 'utf-8'
651650 ) ;
652651
653- const result = JSON . parse ( resultTxt ) ;
652+ const result = JSON . parse ( resultJson ) ;
654653 const computed = JSON . parse ( computedJson ) ;
655654
656655 // Verify single processing result structure (not bulk)
@@ -659,13 +658,13 @@ describe('sendEmail', () => {
659658 'Your email has been sent successfully.'
660659 ) ;
661660 expect ( result ) . toHaveProperty ( 'status' , 200 ) ;
662- expect ( result ) . not . toHaveProperty ( 'total-processed ' ) ;
663- expect ( result ) . not . toHaveProperty ( 'protected-data- results' ) ;
661+ expect ( result ) . not . toHaveProperty ( 'total-count ' ) ;
662+ expect ( result ) . not . toHaveProperty ( 'results' ) ;
664663
665664 // Verify computed.json structure
666665 expect ( computed ) . toHaveProperty ( 'deterministic-output-path' ) ;
667666 expect ( computed [ 'deterministic-output-path' ] ) . toBe (
668- `${ IEXEC_OUT } /result.txt `
667+ `${ IEXEC_OUT } /result.json `
669668 ) ;
670669 } ) ;
671670 } ) ;
0 commit comments