This PR adds some developer-only routes and utilities to aid with writing Cypress tests.
Routes Added:
GET /api/dev/login/:id?
If no id is provided, a new user is created and logged in.
POST /api/dev/run-util
Expects a body of { method: string; args: unknown[] }.
Cypres Commands Added (aliases for the routes above):
createUsers(count?: number)
login(id?: number)
truncateDatabase()
runUtil(method: string, ...args: unknown[])
This method can run any of the exported /server/test/utils functions. It accepts the method's name as the first parameter and the arguments to pass into the function as subsequent parameters.
Extras:
/cypress/e2e/dev.spec.ts was added to demonstrate the use of the newly added commands & endpoint.
Testing
Run automated tests, both Jest and Cypress.
Type of change
Please remove all except for everything applicable, and then remove this line.
Other (test utilities)
Screenshots
N/A
Checklist:
[X] Changes have new/updated automated tests, if applicable
[X] Changes have new/updated docs, if applicable
[X] I have performed a self-review of my own code
[X] I have added comments on any new, hard-to-understand code
Closes N/A
Description
This PR adds some developer-only routes and utilities to aid with writing Cypress tests.
Routes Added:
GET /api/dev/login/:id?
If noid
is provided, a new user is created and logged in.POST /api/dev/run-util
Expects a body of{ method: string; args: unknown[] }
.Cypres Commands Added (aliases for the routes above):
createUsers(count?: number)
login(id?: number)
truncateDatabase()
runUtil(method: string, ...args: unknown[])
This method can run any of the exported/server/test/utils
functions. It accepts the method's name as the first parameter and the arguments to pass into the function as subsequent parameters.Extras:
/cypress/e2e/dev.spec.ts
was added to demonstrate the use of the newly added commands & endpoint.Testing
Run automated tests, both Jest and Cypress.
Type of change
Please remove all except for everything applicable, and then remove this line.
Screenshots
N/A
Checklist: