Skip to content

Conversation

@yamcodes
Copy link
Contributor

@yamcodes yamcodes commented Jul 4, 2025

Closes #3

Summary by CodeRabbit

  • Chores

    • Renamed the development database service and added a separate test database service for improved environment management.
    • Updated and added npm scripts to manage both development and test databases independently.
  • Documentation

    • Improved comments and corrected typos in test and utility files for better clarity.

yamcodes and others added 18 commits July 2, 2025 02:02
…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.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 4, 2025

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 9741d7b and 717df12.

📒 Files selected for processing (3)
  • .env.test.example (1 hunks)
  • docker-compose.yml (2 hunks)
  • package.json (1 hunks)

Walkthrough

The 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

File(s) Change Summary
docker-compose.yml Renamed db service to db-dev, added new db-test service and postgres-test-data volume.
package.json Updated db scripts to target db-dev; added scripts for managing db-test with .env.test.
scripts/test/api.ts Moved DELAY_REQUEST constant; added clarifying comment about Newman parallelism.
src/tags/tags.test.ts Fixed typo in a comment.
src/tests/utils.ts Added lint-disable directive for a console.log statement.

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)
Loading

Assessment against linked issues

Objective Addressed Explanation
Use a separate test db for local API testing (#3)

Poem

A hop, a skip, a database split,
Now test and dev don’t throw a fit!
Compose spins up two bunny dens,
One for code, one for test runs again.
With scripts so neat and changes tight—
The rabbit’s code now feels just right! 🐇✨


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

yamcodes added 3 commits July 4, 2025 18:14
…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.
@yamcodes yamcodes marked this pull request as ready for review July 4, 2025 15:56
@yamcodes yamcodes requested a review from Copilot July 4, 2025 15:59
Copy link

Copilot AI left a 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-dev and adjust existing scripts accordingly.
  • Add a db-test service in Docker Compose and new npm scripts under db: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

@yamcodes
Copy link
Contributor Author

yamcodes commented Jul 4, 2025

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 4, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 names

Giving 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

📥 Commits

Reviewing files that changed from the base of the PR and between dfda2dd and 9741d7b.

📒 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 acknowledged

Nothing else changed; tests remain intact.

src/tests/utils.ts (1)

211-214: ESLint directive is appropriate

Allow-listing the console call only for the verbose branch is clean and keeps lint noise down.

yamcodes added 3 commits July 4, 2025 21:25
…ariable and modifying docker-compose.yml to use it
…pose rm -sf' for consistency and improved functionality
@yamcodes yamcodes merged commit 5c00d5f into main Jul 4, 2025
8 checks passed
@yamcodes yamcodes deleted the separate-test-db branch July 4, 2025 16:30
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.

Make sure we are using a separate test db for local api testing

2 participants