@@ -92,32 +92,52 @@ describe("getDbItemActions", () => {
9292} ) ;
9393
9494describe ( "getGitHubUrl" , ( ) => {
95- it ( "should return the correct url for a remote owner" , ( ) => {
95+ const githubUrl = new URL ( "https://github.com" ) ;
96+
97+ it ( "should return the correct url for a remote owner with github.com" , ( ) => {
9698 const dbItem = createRemoteOwnerDbItem ( ) ;
9799
98- const actualUrl = getGitHubUrl ( dbItem ) ;
100+ const actualUrl = getGitHubUrl ( dbItem , githubUrl ) ;
99101 const expectedUrl = `https://github.com/${ dbItem . ownerName } ` ;
100102
101103 expect ( actualUrl ) . toEqual ( expectedUrl ) ;
102104 } ) ;
103105
104- it ( "should return the correct url for a remote repo" , ( ) => {
106+ it ( "should return the correct url for a remote owner with GHEC-DR" , ( ) => {
107+ const dbItem = createRemoteOwnerDbItem ( ) ;
108+
109+ const actualUrl = getGitHubUrl ( dbItem , new URL ( "https://tenant.ghe.com" ) ) ;
110+ const expectedUrl = `https://tenant.ghe.com/${ dbItem . ownerName } ` ;
111+
112+ expect ( actualUrl ) . toEqual ( expectedUrl ) ;
113+ } ) ;
114+
115+ it ( "should return the correct url for a remote repo with github.com" , ( ) => {
105116 const dbItem = createRemoteRepoDbItem ( ) ;
106117
107- const actualUrl = getGitHubUrl ( dbItem ) ;
118+ const actualUrl = getGitHubUrl ( dbItem , githubUrl ) ;
108119 const expectedUrl = `https://github.com/${ dbItem . repoFullName } ` ;
109120
110121 expect ( actualUrl ) . toEqual ( expectedUrl ) ;
111122 } ) ;
112123
124+ it ( "should return the correct url for a remote repo with GHEC-DR" , ( ) => {
125+ const dbItem = createRemoteRepoDbItem ( ) ;
126+
127+ const actualUrl = getGitHubUrl ( dbItem , new URL ( "https://tenant.ghe.com" ) ) ;
128+ const expectedUrl = `https://tenant.ghe.com/${ dbItem . repoFullName } ` ;
129+
130+ expect ( actualUrl ) . toEqual ( expectedUrl ) ;
131+ } ) ;
132+
113133 it ( "should return undefined for other remote db items" , ( ) => {
114134 const dbItem0 = createRootRemoteDbItem ( ) ;
115135 const dbItem1 = createRemoteSystemDefinedListDbItem ( ) ;
116136 const dbItem2 = createRemoteUserDefinedListDbItem ( ) ;
117137
118- const actualUrl0 = getGitHubUrl ( dbItem0 ) ;
119- const actualUrl1 = getGitHubUrl ( dbItem1 ) ;
120- const actualUrl2 = getGitHubUrl ( dbItem2 ) ;
138+ const actualUrl0 = getGitHubUrl ( dbItem0 , githubUrl ) ;
139+ const actualUrl1 = getGitHubUrl ( dbItem1 , githubUrl ) ;
140+ const actualUrl2 = getGitHubUrl ( dbItem2 , githubUrl ) ;
121141
122142 expect ( actualUrl0 ) . toBeUndefined ( ) ;
123143 expect ( actualUrl1 ) . toBeUndefined ( ) ;
0 commit comments