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

Utilize a different database for testing #224

Closed
wants to merge 4 commits into from
Closed

Conversation

davidgljay
Copy link

What does this PR do?

Recent updates to the database handler cause us to use the same database for testing and for development. This is not a best practice and inconveniently causes the development DB to be cleared every time tests are run. This change ensures that tests are always run in a separate database.

How do I test this PR?

  1. Create a user and post a comment
  2. Run npm test
  3. The user and comment should still exist.

@okbel okbel self-requested a review January 11, 2017 17:24
// default, this is consistent with common testing and use case practices.
if (process.env.NODE_ENV === 'test' && !url) {
if (process.env.NODE_ENV === 'test') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Development should not use the test database. When you start the application, you specify the database to use. When you run tests, you do not load configuration into the environment, as tests would not be predictable if it depended on local configuration. Hence, this change is not necessary, and counter to what is expected if you do override the url.

@davidgljay davidgljay closed this Jan 11, 2017
@davidgljay davidgljay deleted the different_test_db branch January 11, 2017 18:13
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

Successfully merging this pull request may close these issues.

3 participants