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

Commit 920a2dc

Browse files
committed
test: Improve the sanity check for downloaded files
Using 'binary' encoding allows us to check the downloaded file size matches our expectation
1 parent 612d966 commit 920a2dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cypress/e2e/1-webui/database.cy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ describe('database page', () => {
170170
// Simple sanity check of the downloaded file
171171
// TODO - Implement a better check. Maybe create a task that diffs the database to the original test data file?
172172
const db = path.join(downloadsFolder, 'Assembly Election 2017.sqlite')
173-
cy.readFile(db, { timeout: 5000 }).should('have.length.gt', 512)
173+
cy.readFile(db, 'binary', { timeout: 5000 }).should('have.length', 57344)
174174
cy.task('rmFile', { path: db })
175175
})
176176

@@ -201,7 +201,7 @@ describe('database page', () => {
201201
// Simple sanity check of the downloaded file
202202
// TODO - Implement a better check. Maybe keep the "correct" csv in the repo as test data too, and compare against it?
203203
const csv = path.join(downloadsFolder, 'Candidate_Information.csv')
204-
cy.readFile(csv, { timeout: 5000 }).should('have.length.gt', 512)
204+
cy.readFile(csv, 'binary', { timeout: 5000 }).should('have.length', 30773)
205205
cy.task('rmFile', { path: csv })
206206
})
207207

0 commit comments

Comments
 (0)