Fix upload URL test for sanitized filenames - #9
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Upload API test to accommodate server-side filename sanitization so the “upload completes” response assertion no longer expects the unsanitized input name.
Changes:
- Adjusted the chunk-completion test to assert the
downloadUrlsuffix using the returnedfile.filenamerather than a hard-coded filename.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert.strictEqual(chunkResponse.status, 200); | ||
| assert.strictEqual(chunkResponse.data.completed, true); | ||
| assert.ok(chunkResponse.data.file); | ||
| assert.ok(typeof chunkResponse.data.file.downloadUrl === 'string'); | ||
| assert.ok(chunkResponse.data.file.downloadUrl.endsWith('/complete-test.txt')); | ||
| assert.ok(chunkResponse.data.file.downloadUrl.endsWith(`/${chunkResponse.data.file.filename}`)); |
There was a problem hiding this comment.
This assertion is now self-referential: it only checks that downloadUrl ends with whatever file.filename the API returns. That can let regressions slip through (e.g., incorrect sanitization/normalization of the requested name) because the test no longer validates what the filename should be for the input complete-test.txt. Consider asserting an expected sanitized filename (e.g., derived from the known sanitization rules) and then verifying downloadUrl ends with that encoded/sanitized value.
No description provided.