@@ -1570,31 +1570,36 @@ describe("SharedUtils helpers", () => {
15701570 } ,
15711571 } ;
15721572
1573- mockGetMvsApi . mockImplementationOnce ( ( ) => ( { dataSet : jest . fn ( ) . mockResolvedValue ( srcResp ) } ) ) ;
1574- mockGetMvsApi . mockImplementationOnce ( ( ) => ( { dataSet : jest . fn ( ) . mockResolvedValue ( dstResp ) } ) ) ;
1573+ const srcApi = { dataSet : jest . fn ( ) . mockResolvedValue ( srcResp ) } ;
1574+ const dstApi = { dataSet : jest . fn ( ) . mockResolvedValue ( dstResp ) } ;
1575+
1576+ mockGetMvsApi . mockImplementationOnce ( ( ) => srcApi ) ;
1577+ mockGetMvsApi . mockImplementationOnce ( ( ) => dstApi ) ;
15751578
15761579 const same = await SharedUtils . isSamePhysicalDataset ( srcProfile , dstProfile , dsn ) ;
15771580 expect ( same ) . toBe ( true ) ;
15781581
1579- // assert dataSet was called twice
1580- expect ( ( ZoweExplorerApiRegister . getMvsApi ( srcProfile ) as any ) . dataSet ) . toHaveBeenCalled ( ) ;
1581- expect ( ( ZoweExplorerApiRegister . getMvsApi ( dstProfile ) as any ) . dataSet ) . toHaveBeenCalled ( ) ;
1582+ expect ( srcApi . dataSet ) . toHaveBeenCalled ( ) ;
1583+ expect ( dstApi . dataSet ) . toHaveBeenCalled ( ) ;
1584+ expect ( mockGetMvsApi ) . toHaveBeenCalledTimes ( 2 ) ;
15821585 } ) ;
15831586
15841587 test ( "isSamePhysicalDataset returns false when dst dataset missing" , async ( ) => {
15851588 const srcProfile = { name : "SRC" } as any ;
15861589 const dstProfile = { name : "DST" } as any ;
15871590 const dsn = "NON.EXISTENT" ;
15881591
1589- mockGetMvsApi . mockImplementationOnce ( ( ) => ( {
1590- dataSet : jest . fn ( ) . mockResolvedValue ( { apiResponse : { items : [ { dsname : dsn , vols : "VOL01" } ] } } ) ,
1591- } ) ) ;
1592- mockGetMvsApi . mockImplementationOnce ( ( ) => ( {
1593- dataSet : jest . fn ( ) . mockResolvedValue ( { apiResponse : { items : [ ] } } ) ,
1594- } ) ) ;
1592+ const srcApi = { dataSet : jest . fn ( ) . mockResolvedValue ( { apiResponse : { items : [ { dsname : dsn , vols : "VOL01" } ] } } ) } ;
1593+ const dstApi = { dataSet : jest . fn ( ) . mockResolvedValue ( { apiResponse : { items : [ ] } } ) } ;
1594+
1595+ mockGetMvsApi . mockImplementationOnce ( ( ) => srcApi ) ;
1596+ mockGetMvsApi . mockImplementationOnce ( ( ) => dstApi ) ;
15951597
15961598 const same = await SharedUtils . isSamePhysicalDataset ( srcProfile , dstProfile , dsn ) ;
15971599 expect ( same ) . toBe ( false ) ;
1600+
1601+ expect ( srcApi . dataSet ) . toHaveBeenCalled ( ) ;
1602+ expect ( dstApi . dataSet ) . toHaveBeenCalled ( ) ;
15981603 } ) ;
15991604
16001605 test ( "getNodeProperty works for string and nested object" , ( ) => {
0 commit comments