-
Notifications
You must be signed in to change notification settings - Fork 5
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
Safe Test Runner for Mongoose Models #1070
base: develop
Are you sure you want to change the base?
Conversation
src/test/setupSafeTest.js
Outdated
const { restrictedOperations } = require('~/test/test-consts') | ||
|
||
const connectToDatabase = async () => { | ||
const dbUri = process.env.MONGODB_URL_READONLY_TEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add process.env.MONGODB_URL_READONLY_TEST
to config in \src\configs\config.js for consistency as the the setup is done within src
and import as const { config: { MONGODB_URL } } = require('~/configs/config') then
src/test/setupSafeTest.js
Outdated
await connectToDatabase() | ||
initialization(app) | ||
|
||
const server = app.listen(process.env.SERVER_PORT || 8080) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could SERVER_PORT be imported from ~/configs/config for consistency?
|
Description
This PR introduces safe tests for database models. These tests are designed to connect to a real database and verify model functionality.
Key Changes
Added Tests for Database Models:
.env.test.local
file.Environment Variable:
.env.test.local
file:Running Tests:
Removed Model Tests from General Testing Workflow:
How to Test
MONGODB_URL_READONLY_TEST
to your.env.test.local
file.npm run test:models
.Notes