Skip to content

Commit 267e8e8

Browse files
committed
test(files): keep the HTTP check to the routing it proves
1 parent 81b2ebe commit 267e8e8

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎apps/sim/scripts/test-file-delivery-e2e.ts‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,28 +208,27 @@ await check(
208208
}
209209
}
210210
)
211-
await check('v2 workspace download addressed by an encoded files/ VFS path', async () => {
211+
await check('v2 workspace download routes a %2F-encoded files/ VFS path to its file', async () => {
212212
const folderResponse = await request(`/api/workspaces/${workspaceId}/files/folders`, {
213213
method: 'POST',
214214
body: JSON.stringify({ name: 'VfsDocs' }),
215215
})
216216
assert.ok(folderResponse.ok, `Folder create returned ${folderResponse.status}`)
217217
const folderId = required(toRecord(toRecord(await folderResponse.json()).folder).id)
218218
await create('workspace', 'vfs-report.csv', 'text/csv', 'root copy')
219-
const nested = await create('workspace', 'vfs-report.csv', 'text/csv', 'folder copy', folderId)
220-
const download = (fileId: string) =>
219+
await create('workspace', 'vfs-report.csv', 'text/csv', 'folder copy', folderId)
220+
const download = (path: string) =>
221221
request(
222-
`/api/v2/files/${encodeURIComponent(fileId)}?workspaceId=${workspaceId}`,
222+
`/api/v2/files/${encodeURIComponent(path)}?workspaceId=${workspaceId}`,
223223
{ headers: { 'X-API-Key': personalKey } },
224224
true
225225
)
226-
for (const [fileId, content] of [
226+
for (const [path, content] of [
227227
['files/VfsDocs/vfs-report.csv', 'folder copy'],
228-
[required(nested.id), 'folder copy'],
229228
['files/vfs-report.csv', 'root copy'],
230229
]) {
231-
const response = await download(fileId)
232-
assert.equal(response.status, 200, `${fileId} returned ${response.status}`)
230+
const response = await download(path)
231+
assert.equal(response.status, 200, `${path} returned ${response.status}`)
233232
assert.equal(await response.text(), content)
234233
}
235234
assert.equal((await download('files/VfsDocs/missing.csv')).status, 404)

0 commit comments

Comments
 (0)