-
Notifications
You must be signed in to change notification settings - Fork 0
Separate test db #11
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
Separate test db #11
Conversation
…ntroducing favoritedBy and updating favorites handling. Removed unused Favorite and Follow models for improved clarity and maintainability.
…ing the follow model with direct updates to the user model. This enhances clarity and reduces redundancy in follow/unfollow operations, improving overall code maintainability.
…ting the query structure for retrieving followed users. This change improves clarity and aligns with recent updates in user relationship handling.
…ming followers to followedBy and favorites to favoritedBy. This change enhances clarity in the enriched article interface and aligns with recent updates in user data retrieval.
…e codebase, enhancing clarity in user interactions and data representation. Update response mapping and article interface to reflect this change, ensuring consistency in favorited status and count handling.
…dBy, improving clarity in user interactions and aligning with recent updates in data representation. This change enhances the consistency of the article interface.
… and modifying test command structure. Introduce performance options for API tests, allowing for configurable request delays and conditional database reset.
- Fix password validation by using a stronger password (Password123) - Add missing auth: true to articles POST endpoint - Add authentication headers to article creation test - All Eden Treaty tests now pass locally
- Renamed test scripts for clarity and added a legacy test command. - Enhanced fast API tests by adding a second user for authentication checks. - Implemented additional assertions for user and article interactions. - Improved error handling in tests for unauthorized access and invalid login scenarios. - Added cleanup tests for articles and comments to ensure proper resource management.
…article management, and comments - Implemented tests to ensure users cannot register with missing fields or duplicate emails/usernames. - Added tests to verify login failures with incorrect passwords and missing fields. - Included tests for article management to prevent unauthorized actions such as updating, deleting, and favoriting articles. - Added checks for comment creation and deletion to ensure proper authorization and existence validation. - Enhanced profile follow/unfollow tests to handle unauthenticated and non-existent user scenarios.
…d functionality - Renamed test commands for better understanding and added a legacy test command. - Removed the fast API test file to streamline the testing process. - Updated the test command to run in watch mode for enhanced development experience.
- Renamed the test command from "test:legacy" to "test:api" for clarity. - Updated GitHub Actions workflow to run API tests only, removing unit tests for a streamlined process. - Added new user registration and login tests to validate success and error scenarios. - Improved assertions in existing tests to ensure comprehensive coverage of user interactions.
…base - Deleted the `slugify` function from `utils.ts` as it was no longer needed. - Removed all test files related to articles, users, and index tests to clean up the testing suite. - This cleanup helps in maintaining a more focused and efficient codebase.
- Updated import statements in test files to use the new utility functions from `tests.utils`. - Added a second user registration and login process in the profiles test to improve authentication coverage. - This refactor aims to streamline test organization and enhance the robustness of user-related tests.
|
Warning Rate limit exceeded@yamcodes has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 47 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughThe changes introduce a dedicated PostgreSQL service and volume for testing, distinct from the development database, in the Docker Compose configuration. Corresponding npm scripts are updated and expanded to manage both the development and test databases separately. Minor comment and linting improvements are also included in test-related scripts and files. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant NPM_Scripts
participant DockerCompose
participant db-dev
participant db-test
User->>NPM_Scripts: Run db:start / db:test:start
NPM_Scripts->>DockerCompose: up -d db-dev / up -d db-test
DockerCompose->>db-dev: Start (dev database)
DockerCompose->>db-test: Start (test database)
User->>NPM_Scripts: Run db:test:push
NPM_Scripts->>db-test: Apply Prisma schema (with .env.test)
Assessment against linked issues
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
…vironments - Renamed the database service from `db` to `db-dev` for clarity. - Added a new `db-test` service for testing purposes with specific environment variables. - Updated various database-related commands in `package.json` to target the new `db-dev` and `db-test` services, enhancing the development workflow.
…o separate-test-db
…d of hardcoded value
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.
Pull Request Overview
This PR separates the test database from the development database by introducing a dedicated db-test service and updating related npm scripts.
- Rename the primary DB service to
db-devand adjust existing scripts accordingly. - Add a
db-testservice in Docker Compose and new npm scripts underdb:test:*. - Include a lint ignore for console output and correct a comment typo in tests.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/tests/utils.ts | Add biome-ignore for intentional console.log in verbose reset |
| src/tags/tags.test.ts | Correct typo in comment from // Test dataW to // Test data |
| scripts/test/api.ts | Move and re-enable DELAY_REQUEST performance option block |
| package.json | Update and expand db:* scripts to target db-dev and db-test |
| docker-compose.yml | Rename db to db-dev; add a new db-test service and volume |
Comments suppressed due to low confidence (1)
src/tags/tags.test.ts:9
- There's an extraneous 'W' in the comment on the removed line. It was fixed to 'Test data' but please verify other nearby comments for similar typos.
// Test data
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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.
Actionable comments posted: 3
♻️ Duplicate comments (1)
package.json (1)
31-31: Run test DB in detached mode for parity with dev scripts
This is exactly the point raised in an earlier review; repeating here for visibility.
🧹 Nitpick comments (1)
docker-compose.yml (1)
2-23: Minor but useful: add explicit container namesGiving each service a fixed
container_name(bedstack-db-dev,bedstack-db-test) simplifies scripts and avoids accidental re-use of anonymous names when containers are recreated.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
docker-compose.yml(2 hunks)package.json(1 hunks)scripts/test/api.ts(1 hunks)src/tags/tags.test.ts(1 hunks)src/tests/utils.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, there's a local copy strategy for the Postman collection where `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` pointing to a local copy, providing a fallback for testing scenarios while the main env.ts uses the remote GitHub URL as default.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` as a planned local fallback strategy, but the tests directory and local Postman collection file need to be created to complete the implementation.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the .env.test.example file contains `POSTMAN_COLLECTION=./scripts/test/Conduit.postman_collection.json` pointing to a local copy in the scripts/test directory, not the tests directory as initially assumed.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the local fallback strategy for POSTMAN_COLLECTION is now fully implemented with the file existing at scripts/test/Conduit.postman_collection.json and .env.test.example correctly configured to use the local path.
scripts/test/api.ts (4)
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, there's a local copy strategy for the Postman collection where `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` pointing to a local copy, providing a fallback for testing scenarios while the main env.ts uses the remote GitHub URL as default.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` as a planned local fallback strategy, but the tests directory and local Postman collection file need to be created to complete the implementation.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the .env.test.example file contains `POSTMAN_COLLECTION=./scripts/test/Conduit.postman_collection.json` pointing to a local copy in the scripts/test directory, not the tests directory as initially assumed.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the local fallback strategy for POSTMAN_COLLECTION is now fully implemented with the file existing at scripts/test/Conduit.postman_collection.json and .env.test.example correctly configured to use the local path.
package.json (2)
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:43:01.460Z
Learning: In the bepstack project, the .env.test.example file contains `POSTMAN_COLLECTION=./scripts/test/Conduit.postman_collection.json` pointing to a local copy in the scripts/test directory, not the tests directory as initially assumed.
Learnt from: yamcodes
PR: bedtime-coders/bepstack#9
File: src/core/env.ts:25-28
Timestamp: 2025-07-04T15:36:36.132Z
Learning: In the bepstack project, `.env.test.example` contains `POSTMAN_COLLECTION=./tests/Conduit.postman_collection.json` as a planned local fallback strategy, but the tests directory and local Postman collection file need to be created to complete the implementation.
🔇 Additional comments (2)
src/tags/tags.test.ts (1)
9-9: Typo fix acknowledgedNothing else changed; tests remain intact.
src/tests/utils.ts (1)
211-214: ESLint directive is appropriateAllow-listing the console call only for the verbose branch is clean and keeps lint noise down.
…ariable and modifying docker-compose.yml to use it
… for improved database removal
…pose rm -sf' for consistency and improved functionality
Closes #3
Summary by CodeRabbit
Chores
Documentation