@@ -47,6 +47,7 @@ import { SettingsConfig } from "../../../../src/configuration/SettingsConfig";
4747import { MockedProperty } from "../../../__mocks__/mockUtils" ;
4848import { AuthUtils } from "../../../../src/utils/AuthUtils" ;
4949import { ImperativeError } from "@zowe/imperative" ;
50+ import { error } from "console" ;
5051
5152// Missing the definition of path module, because I need the original logic for tests
5253jest . mock ( "fs" ) ;
@@ -1912,22 +1913,19 @@ describe("ZoweDatasetNode Unit Tests - listMembersInRange()", () => {
19121913 } ) ;
19131914 it ( "returns an empty list, if listMembersInRange throws a 404 error" , async ( ) => {
19141915 const pdsNode = new ZoweDatasetNode ( {
1915- label : "PDS.ERROR " ,
1916+ label : "PDS.404 " ,
19161917 collapsibleState : vscode . TreeItemCollapsibleState . Expanded ,
19171918 contextOverride : Constants . DS_PDS_CONTEXT ,
19181919 } ) ;
19191920
1920- const notFoundError = new imperative . ImperativeError ( {
1921- msg : "Datasets not cataloged" ,
1922- errorCode : "404" ,
1923- } ) ;
1924-
1925- jest . spyOn ( pdsNode , "listMembers" ) . mockImplementationOnce ( async ( ) => {
1926- throw notFoundError ;
1927- } ) ;
1921+ jest . spyOn ( pdsNode , "listMembers" ) . mockRejectedValue (
1922+ new imperative . ImperativeError ( {
1923+ msg : "Dataset not cataloged" ,
1924+ errorCode : `${ imperative . RestConstants . HTTP_STATUS_404 } ` ,
1925+ } )
1926+ ) ;
19281927
19291928 const result = await ( pdsNode as any ) . listMembersInRange ( undefined , 2 ) ;
1930- console . log ( "HELLO" + result . items ) ;
19311929 expect ( result ) . toStrictEqual ( { items : [ ] } ) ;
19321930 } ) ;
19331931} ) ;
0 commit comments