@@ -115,6 +115,10 @@ func TestListFilesSuccess(t *testing.T) {
115
115
err = os .Mkdir (downloadsDir , 0o755 )
116
116
require .NoError (t , err )
117
117
118
+ textFile := filepath .Join (tmpDir , "file.txt" )
119
+ err = os .WriteFile (textFile , []byte ("content" ), 0o600 )
120
+ require .NoError (t , err )
121
+
118
122
var queryComponents []string
119
123
// We can't get an absolute path relative to empty string on Windows.
120
124
if runtime .GOOS == "windows" && base == "" {
@@ -133,23 +137,23 @@ func TestListFilesSuccess(t *testing.T) {
133
137
require .NoError (t , err )
134
138
135
139
require .Equal (t , tmpDir , resp .AbsolutePathString )
136
-
137
- var foundRepos , foundDownloads bool
138
- for _ , file := range resp . Contents {
139
- switch file . Name {
140
- case "repos" :
141
- foundRepos = true
142
- expectedPath := filepath . Join ( tmpDir , "repos" )
143
- require . Equal ( t , expectedPath , file . AbsolutePathString )
144
- require . True ( t , file . IsDir )
145
- case "Downloads" :
146
- foundDownloads = true
147
- expectedPath := filepath . Join ( tmpDir , "Downloads" )
148
- require . Equal ( t , expectedPath , file .AbsolutePathString )
149
- require . True ( t , file . IsDir )
150
- }
151
- }
152
- require . True ( t , foundRepos && foundDownloads , "expected to find both repos and Downloads directories, got: %+v" , resp .Contents )
140
+ require . ElementsMatch ( t , [] LSFile {
141
+ {
142
+ Name : "repos" ,
143
+ AbsolutePathString : reposDir ,
144
+ IsDir : true ,
145
+ },
146
+ {
147
+ Name : "Downloads" ,
148
+ AbsolutePathString : downloadsDir ,
149
+ IsDir : true ,
150
+ },
151
+ {
152
+ Name : " file.txt" ,
153
+ AbsolutePathString : textFile ,
154
+ IsDir : false ,
155
+ },
156
+ } , resp .Contents )
153
157
})
154
158
}
155
159
}
@@ -186,4 +190,12 @@ func TestListFilesListDrives(t *testing.T) {
186
190
}
187
191
resp , err = listFiles (query )
188
192
require .NoError (t , err )
193
+
194
+ query = LSRequest {
195
+ // Network drives are not supported.
196
+ Path : []string {"\\ sshfs\\ work" },
197
+ Relativity : LSRelativityRoot ,
198
+ }
199
+ resp , err = listFiles (query )
200
+ require .ErrorContains (t , err , "drive" )
189
201
}
0 commit comments