@@ -98,21 +98,33 @@ suite('createEditAddingLinksForUriList', () => {
98
98
99
99
suite ( 'appendToLinkSnippet' , ( ) => {
100
100
test ( 'Should not create Markdown link snippet when pasteAsMarkdownLink is false' , ( ) => {
101
- const uri = vscode . Uri . parse ( 'https://www.microsoft.com/' ) ;
102
- const snippet = appendToLinkSnippet ( new vscode . SnippetString ( '' ) , false , 'https:/www.microsoft.com' , '' , uri , 0 , true ) ;
103
- assert . strictEqual ( snippet ?. value , 'https://www.microsoft.com/ ' ) ;
101
+ const uriString = 'https://www.microsoft.com' ;
102
+ const snippet = appendToLinkSnippet ( new vscode . SnippetString ( '' ) , false , 'https:/www.microsoft.com' , '' , uriString , 0 , true ) ;
103
+ assert . strictEqual ( snippet ?. value , 'https://www.microsoft.com' ) ;
104
104
} ) ;
105
105
106
106
test ( 'Should create Markdown link snippet when pasteAsMarkdownLink is true' , ( ) => {
107
- const uri = vscode . Uri . parse ( 'https://www.microsoft.com/' ) ;
108
- const snippet = appendToLinkSnippet ( new vscode . SnippetString ( '' ) , true , 'https:/www.microsoft.com' , '' , uri , 0 , true ) ;
109
- assert . strictEqual ( snippet ?. value , '[${0:Title}](https://www.microsoft.com/ )' ) ;
107
+ const uriString = 'https://www.microsoft.com' ;
108
+ const snippet = appendToLinkSnippet ( new vscode . SnippetString ( '' ) , true , 'https:/www.microsoft.com' , '' , uriString , 0 , true ) ;
109
+ assert . strictEqual ( snippet ?. value , '[${0:Title}](https://www.microsoft.com)' ) ;
110
110
} ) ;
111
111
112
112
test ( 'Should use an unencoded URI string in Markdown link when passing in an external browser link' , ( ) => {
113
- const uri = vscode . Uri . parse ( 'https://www.microsoft.com/' ) ;
114
- const snippet = appendToLinkSnippet ( new vscode . SnippetString ( '' ) , true , 'https:/www.microsoft.com' , '' , uri , 0 , true ) ;
115
- assert . strictEqual ( snippet ?. value , '[${0:Title}](https://www.microsoft.com/)' ) ;
113
+ const uriString = 'https://www.microsoft.com' ;
114
+ const snippet = appendToLinkSnippet ( new vscode . SnippetString ( '' ) , true , 'https:/www.microsoft.com' , '' , uriString , 0 , true ) ;
115
+ assert . strictEqual ( snippet ?. value , '[${0:Title}](https://www.microsoft.com)' ) ;
116
+ } ) ;
117
+
118
+ test ( 'Should not decode an encoded URI string when passing in an external browser link' , ( ) => {
119
+ const uriString = 'https://www.microsoft.com/%20' ;
120
+ const snippet = appendToLinkSnippet ( new vscode . SnippetString ( '' ) , true , 'https:/www.microsoft.com' , '' , uriString , 0 , true ) ;
121
+ assert . strictEqual ( snippet ?. value , '[${0:Title}](https://www.microsoft.com/%20)' ) ;
122
+ } ) ;
123
+
124
+ test ( 'Should not encode an unencoded URI string when passing in an external browser link' , ( ) => {
125
+ const uriString = 'https://www.example.com/path?query=value&another=value#fragment' ;
126
+ const snippet = appendToLinkSnippet ( new vscode . SnippetString ( '' ) , true , 'https:/www.microsoft.com' , '' , uriString , 0 , true ) ;
127
+ assert . strictEqual ( snippet ?. value , '[${0:Title}](https://www.example.com/path?query=value&another=value#fragment)' ) ;
116
128
} ) ;
117
129
} ) ;
118
130
0 commit comments