@@ -16,62 +16,66 @@ import { CICSRegionTree } from "../../../src/trees/CICSRegionTree";
16
16
import { CICSSessionTree } from "../../../src/trees/CICSSessionTree" ;
17
17
import * as globalMocks from "../../__utils__/globalMocks" ;
18
18
19
+
19
20
jest . mock ( "@zowe/zowe-explorer-api" ) ;
20
21
jest . mock ( "../../../src/utils/iconUtils" , ( ) => {
21
22
return { getIconFilePathFromName : getIconFilePathFromNameMock } ;
22
23
} ) ;
23
- const cicsTreeMock = jest . fn ( ) ;
24
+ const cicstreeMock = jest . fn ( ) ;
24
25
const treeResourceMock = globalMocks . getDummyTreeResources ( "cicsmanagedregion" , "fileName*" ) ;
25
26
const profile = {
26
27
profile : { user : "user" , password : "pwd" , hostname : "hostname" , protocol : "https" , type : "basic" , rejectUnauthorized : false , port : 8080 } ,
27
28
} ;
28
29
describe ( "Test suite for CICSSessionTree" , ( ) => {
29
30
let sut : CICSSessionTree ;
30
31
31
- beforeEach ( ( ) => {
32
- getIconFilePathFromNameMock . mockReturnValue ( treeResourceMock . iconPath ) ;
32
+ describe ( "Validation" , ( ) => {
33
33
34
- sut = new CICSSessionTree ( profile ) ;
35
- sut . isUnauthorized = true ;
36
- expect ( getIconFilePathFromNameMock ) . toHaveBeenCalledWith ( "profile-unverified" ) ;
37
- } ) ;
34
+ beforeEach ( ( ) => {
35
+ getIconFilePathFromNameMock . mockReturnValue ( treeResourceMock . iconPath ) ;
38
36
39
- afterEach ( ( ) => {
40
- jest . resetAllMocks ( ) ;
41
- } ) ;
37
+ sut = new CICSSessionTree ( profile ) ;
38
+ sut . isUnauthorized = true ;
39
+ expect ( getIconFilePathFromNameMock ) . toHaveBeenCalledWith ( "profile-unverified" ) ;
40
+ } ) ;
42
41
43
- describe ( "Test suite for addRegion" , ( ) => {
44
- it ( "should push CICSRegionTree object into children" , ( ) => {
45
- sut . addRegion ( cicsTreeMock as any as CICSRegionTree ) ;
46
- expect ( sut . getChildren ( ) . length ) . toBeGreaterThanOrEqual ( 1 ) ;
42
+ afterEach ( ( ) => {
43
+ jest . resetAllMocks ( ) ;
47
44
} ) ;
48
- } ) ;
49
- describe ( "Test suite for addPlex" , ( ) => {
50
- it ( "should push CICSPlexTree object into children" , ( ) => {
51
- sut . addPlex ( cicsTreeMock as any as CICSPlexTree ) ;
52
- expect ( sut . getChildren ( ) . length ) . toBeGreaterThanOrEqual ( 1 ) ;
45
+
46
+ describe ( "Test suite for addRegion" , ( ) => {
47
+ it ( "should push CICSRegionTree object into children" , ( ) => {
48
+ sut . addRegion ( cicstreeMock as any as CICSRegionTree ) ;
49
+ expect ( sut . getChildren ( ) . length ) . toBeGreaterThanOrEqual ( 1 ) ;
50
+ } ) ;
53
51
} ) ;
54
- } ) ;
55
- describe ( "Test suite for getChildren" , ( ) => {
56
- it ( "should return an array of childrens" , ( ) => {
57
- expect ( sut . getChildren ( ) . length ) . toBeGreaterThanOrEqual ( 0 ) ;
52
+ describe ( "Test suite for addPlex" , ( ) => {
53
+ it ( "should push CICSPlexTree object into children" , ( ) => {
54
+ sut . addPlex ( cicstreeMock as any as CICSPlexTree ) ;
55
+ expect ( sut . getChildren ( ) . length ) . toBeGreaterThanOrEqual ( 1 ) ;
56
+ } ) ;
58
57
} ) ;
59
- } ) ;
60
- describe ( "Test suite for setUnauthorized" , ( ) => {
61
- it ( "should set isUnauthorized to true" , ( ) => {
62
- sut . setUnauthorized ( ) ;
63
- expect ( sut . isUnauthorized ) . toBeTruthy ( ) ;
58
+ describe ( "Test suite for getChildren" , ( ) => {
59
+ it ( "should return an array of childrens" , ( ) => {
60
+ expect ( sut . getChildren ( ) . length ) . toBeGreaterThanOrEqual ( 0 ) ;
61
+ } ) ;
64
62
} ) ;
65
- } ) ;
66
- describe ( "Test suite for setAuthorized ", ( ) => {
67
- it ( "should set isUnauthorized to false" , ( ) => {
68
- sut . setAuthorized ( ) ;
69
- expect ( sut . isUnauthorized ) . toBeFalsy ( ) ;
63
+ describe ( "Test suite for setUnauthorized" , ( ) => {
64
+ it ( "should set isUnauthorized to true ", ( ) => {
65
+ sut . setUnauthorized ( ) ;
66
+ expect ( sut . isUnauthorized ) . toBeTruthy ( ) ;
67
+ } ) ;
70
68
} ) ;
71
- } ) ;
72
- describe ( "Test suite for getIsUnauthorized" , ( ) => {
73
- it ( "should return the object of isUnauthorized" , ( ) => {
74
- expect ( sut . getIsUnauthorized ( ) ) . toBeTruthy ( ) ;
69
+ describe ( "Test suite for setAuthorized" , ( ) => {
70
+ it ( "should set isUnauthorized to false" , ( ) => {
71
+ sut . setAuthorized ( ) ;
72
+ expect ( sut . isUnauthorized ) . toBeFalsy ( ) ;
73
+ } ) ;
74
+ } ) ;
75
+ describe ( "Test suite for getIsUnauthorized" , ( ) => {
76
+ it ( "should return the object of isUnauthorized" , ( ) => {
77
+ expect ( sut . getIsUnauthorized ( ) ) . toBeTruthy ( ) ;
78
+ } ) ;
75
79
} ) ;
76
80
} ) ;
77
81
} ) ;
0 commit comments