Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test files should be updated to use a test database #45

Open
FOSSforlife opened this issue Apr 26, 2020 · 1 comment
Open

Test files should be updated to use a test database #45

FOSSforlife opened this issue Apr 26, 2020 · 1 comment

Comments

@FOSSforlife
Copy link

Since mockDBConnection is no longer an option, the following changes should be made:

  • Tests should use a test database (probably using the same Postgres setup and credentials but using a different value for WARTHOG_DB_DATABASE). This can be done either using a separate .env file or by setting the variable in the test npm script.
    • It would also be helpful to have a script to instantiate this db:
    "bootstrap:test": "WARTHOG_DB_DATABASE=warthog-starter-test yarn db:create && WARTHOG_DB_DATABASE=warthog-starter-test yarn db:migrate",
  • project.integration.test.ts: Remove mockDBConnection from getServer() call
  • testHelpers.ts: deleteTempDB() helper function should be replaced with either running yarn db:drop or hard-deleting the Project created in the integration test. The calls to it in globalSetup.ts and globalTeardown.ts should be removed.
@goldcaddy77
Copy link
Owner

Thanks @FOSSforlife . I do most of this already in Warthog. I can copy the setup from there. Also happy to review a PR if you want to try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants