@@ -96,6 +96,48 @@ suite('gitProvider', function () {
9696 } ) ;
9797 } ) ;
9898
99+ suite ( 'GitLab' , function ( ) {
100+ const remoteUrl = `https://gitlab.com/${ userName } /${ repoName } .git` ;
101+ const provider = gitProvider ( remoteUrl ) ;
102+
103+ suite ( '#webUrl(branch, filePath)' , function ( ) {
104+ test ( 'should returns file URL' , function ( ) {
105+ const expectedUrl = `https://gitlab.com/${ userName } /${ repoName } /blob/${ branch } ${ filePath } ` ;
106+ const webUrl = provider . webUrl ( branch , filePath ) ;
107+ expect ( webUrl ) . to . equal ( expectedUrl ) ;
108+ } ) ;
109+ } ) ;
110+
111+ suite ( '#webUrl(branch, filePath, line)' , function ( ) {
112+ test ( 'should returns file URL with line hash' , function ( ) {
113+ const expectedUrl = `https://gitlab.com/${ userName } /${ repoName } /blob/${ branch } ${ filePath } #L${ line } ` ;
114+ const webUrl = provider . webUrl ( branch , filePath , line ) ;
115+ expect ( webUrl ) . to . equal ( expectedUrl ) ;
116+ } ) ;
117+ } ) ;
118+
119+ suite ( '#webUrl(branch)' , function ( ) {
120+ test ( 'should returns repository root URL' , function ( ) {
121+ const expectedUrl = `https://gitlab.com/${ userName } /${ repoName } /tree/${ branch } ` ;
122+ const webUrl = provider . webUrl ( branch ) ;
123+ expect ( webUrl ) . to . equal ( expectedUrl ) ;
124+ } ) ;
125+ } ) ;
126+
127+ suite ( 'with ssh remote URL' , function ( ) {
128+ const remoteUrl = `[email protected] :${ userName } /${ repoName } .git` ; 129+ const provider = gitProvider ( remoteUrl ) ;
130+
131+ suite ( '#webUrl(branch, filePath)' , function ( ) {
132+ test ( 'should returns HTTPS URL' , function ( ) {
133+ const expectedUrl = `https://gitlab.com/${ userName } /${ repoName } /blob/${ branch } ${ filePath } ` ;
134+ const webUrl = provider . webUrl ( branch , filePath ) ;
135+ expect ( webUrl ) . to . equal ( expectedUrl ) ;
136+ } ) ;
137+ } ) ;
138+ } ) ;
139+ } ) ;
140+
99141 suite ( 'VisualStudio' , function ( ) {
100142 const projectName = 'testProject' ;
101143 const remoteUrl = `https://test-account.visualstudio.com/${ projectName } /_git/${ repoName } .git` ;
0 commit comments