Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 90aca10

Browse files
committed
test: Improve the test for the download() api function
1 parent c582e47 commit 90aca10

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cypress/e2e/2-api/api.cy.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ describe('api tests', () => {
258258
method: 'POST',
259259
url: 'https://localhost:9444/v1/download',
260260
form: true,
261+
encoding: "binary",
261262
body: {
262263
apikey: '2MXwA5jGZkIQ3UNEcKsuDNSPMlx',
263264
dbowner: 'default',
@@ -269,14 +270,10 @@ describe('api tests', () => {
269270

270271
// Save the database to local disk
271272
const db = path.join(downloadsFolder, 'Assembly Election 2017.sqlite')
272-
// FIXME: cy.writeFile() isn't writing the full file out to disk, even though the server
273-
// is definitely sending it (as evidenced by curl having no issues). It would be
274-
// good to figure out wtf is causing this problem, then fix it and write a more
275-
// thorough cy.readFile() test.
276273
cy.writeFile(db, response.body, 'binary')
277274

278275
// Verify the downloaded file is ok
279-
cy.readFile(db, 'binary', { timeout: 5000 }).should('have.length.gt', 512)
276+
cy.readFile(db, 'binary', { timeout: 5000 }).should('have.length', 73728)
280277

281278
// Remove the downloaded file
282279
cy.task('rmFile', { path: db })

0 commit comments

Comments
 (0)