@@ -414,9 +414,10 @@ describe('TestRunsService', () => {
414414 } ) ;
415415 } ) ;
416416
417- it ( 'calculate no diff ' , async ( ) => {
417+ it ( 'recalculateDiff ' , async ( ) => {
418418 const testRun = {
419419 id : 'id' ,
420+ buildId : 'buildId' ,
420421 imageName : 'imageName' ,
421422 baselineName : 'baselineName' ,
422423 diffTollerancePercent : 12 ,
@@ -443,6 +444,7 @@ describe('TestRunsService', () => {
443444 } ) ;
444445 service . findOne = testRunFindOneMock ;
445446 service . getDiff = getDiffMock ;
447+ service . emitUpdateBuildEvent = jest . fn ( ) ;
446448
447449 await service . recalculateDiff ( testRun . id ) ;
448450
@@ -456,6 +458,7 @@ describe('TestRunsService', () => {
456458 testRun . diffTollerancePercent ,
457459 testRun . ignoreAreas
458460 ) ;
461+ expect ( service . emitUpdateBuildEvent ) . toBeCalledWith ( testRun . buildId ) ;
459462 } ) ;
460463
461464 describe ( 'saveDiffResult' , ( ) => {
@@ -478,32 +481,32 @@ describe('TestRunsService', () => {
478481 } ,
479482 } ) ;
480483 } ) ;
481- } ) ;
482-
483- it ( 'with results' , async ( ) => {
484- const diff : DiffResult = {
485- status : TestStatus . unresolved ,
486- diffName : 'diff image name' ,
487- pixelMisMatchCount : 11 ,
488- diffPercent : 22 ,
489- isSameDimension : true ,
490- } ;
491- const id = 'some id' ;
492- const testRunUpdateMock = jest . fn ( ) ;
493- service = await initService ( {
494- testRunUpdateMock,
495- } ) ;
496-
497- await service . saveDiffResult ( id , diff ) ;
498484
499- expect ( testRunUpdateMock ) . toHaveBeenCalledWith ( {
500- where : { id } ,
501- data : {
502- status : diff . status ,
503- diffName : diff . diffName ,
504- pixelMisMatchCount : diff . pixelMisMatchCount ,
505- diffPercent : diff . diffPercent ,
506- } ,
485+ it ( 'with results' , async ( ) => {
486+ const diff : DiffResult = {
487+ status : TestStatus . unresolved ,
488+ diffName : 'diff image name' ,
489+ pixelMisMatchCount : 11 ,
490+ diffPercent : 22 ,
491+ isSameDimension : true ,
492+ } ;
493+ const id = 'some id' ;
494+ const testRunUpdateMock = jest . fn ( ) ;
495+ service = await initService ( {
496+ testRunUpdateMock,
497+ } ) ;
498+
499+ await service . saveDiffResult ( id , diff ) ;
500+
501+ expect ( testRunUpdateMock ) . toHaveBeenCalledWith ( {
502+ where : { id } ,
503+ data : {
504+ status : diff . status ,
505+ diffName : diff . diffName ,
506+ pixelMisMatchCount : diff . pixelMisMatchCount ,
507+ diffPercent : diff . diffPercent ,
508+ } ,
509+ } ) ;
507510 } ) ;
508511 } ) ;
509512
0 commit comments