Skip to content

refactor: 테스트 설정 리펙토링#84

Merged
rootTiket merged 5 commits intodevfrom
refactor/#83
Jul 17, 2025
Merged

refactor: 테스트 설정 리펙토링#84
rootTiket merged 5 commits intodevfrom
refactor/#83

Conversation

@rootTiket
Copy link
Contributor

@rootTiket rootTiket commented Jul 17, 2025

🚀 PR 요약

지저분한 테스트 설정들을 리펙토링 했습니다.

✨ PR 상세 내용

  1. Application, Service 레이어 설정 분리
  2. 외부 API (Redis, Firebase) Mocking 처리
  3. JwtProvider 같은 단위테스트에서 불필요한 의존성 제거

🚨 주의 사항

나중에 레디스, 파이어베이스 관련 테스트 할때는 또 설정을 좀 바꿔야 해요 ㅎ ;;

✅ 체크 리스트

  • 리뷰어 설정했나요?
  • Label 설정했나요?
  • 제목 양식 맞췄나요? (ex. feat: 기능 추가)
  • 변경 사항에 대한 테스트를 진행했나요?

Summary by CodeRabbit

  • Tests

    • Improved test isolation by mocking external Redis and Firebase dependencies in several test classes.
    • Added a new test class for JPA-related service testing.
    • Updated and re-enabled article creation tests with push notification and subscription scenarios.
    • Refactored test configurations for more focused test contexts and simplified setup.
    • Enhanced test fixtures for easier push subscription creation.
    • Adjusted repository cleanup to include push subscription records.
  • Chores

    • Updated test environment configuration files for better database and Firebase setup.
    • Removed obsolete and redundant test configuration files.
    • Added a mock Firebase service account file for testing purposes.
  • New Features

    • Updated API documentation server URL to use a custom domain for deployment.

@rootTiket rootTiket requested a review from ose0221 July 17, 2025 08:54
@rootTiket rootTiket self-assigned this Jul 17, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 17, 2025

Walkthrough

This update enhances and refactors the test infrastructure for the application. It introduces new mocks for Redis and Firebase dependencies, restructures test base classes, adds cleanup routines for push subscriptions, updates test configuration files, and introduces a placeholder Firebase service account for testing. Some obsolete configuration files and annotations are removed.

Changes

File(s) Change Summary
.../domain/ApplicationTest.java Added @MockitoBean mocks for Redis and Firebase beans to isolate tests from external dependencies.
.../domain/ServiceTest.java Introduced new base test class with JPA test setup and repository cleanup after each test.
.../domain/article/application/ArticleManagementUsecaseTest.java Re-enabled and updated a test to mock notification scheduling and persist push subscriptions.
.../domain/article/application/ArticleRemindTest.java
.../category/domain/service/CategoryGetServiceTest.java
.../global/common/jwt/JwtProviderTest.java
Removed unused RedisMessageListenerContainer mocks and refactored test configuration; updated base class usage.
.../domain/fixture/CustomRepository.java Modified cleanup method to also clear the push_subscription table.
.../domain/fixture/TestFixture.java Added static method to create PushSubscription test objects.
.../global/config/redis/TestRedisConfig.java Deleted obsolete Spring test configuration class for Redis.
.../resources/application-test.properties Changed Hibernate DDL mode to create-drop; updated FCM property to use a JSON credential file.
.../resources/application-test.yml Deleted redundant or obsolete YAML test configuration file.
.../resources/firebase-service-account-test.json Added mock Firebase service account JSON for testing.
.../global/config/swagger/SwaggerConfig.java Updated Swagger server URL from IP-based nip.io domain to custom domain.

Sequence Diagram(s)

sequenceDiagram
    participant TestClass
    participant MockedRedis
    participant MockedFirebase
    participant CustomRepository

    TestClass->>MockedRedis: Inject mocked Redis beans
    TestClass->>MockedFirebase: Inject mocked Firebase beans
    TestClass->>CustomRepository: Use repository for test operations
    TestClass->>CustomRepository: AfterEach: clearAndReset()
    CustomRepository->>Database: Delete from article, push_subscription, category, users
Loading

Suggested reviewers

  • ose0221

Poem

A rabbit hops through test and code,
With mocks for Redis, Firebase bestowed.
Old configs gone, new fixtures in,
Push subscriptions cleaned with a grin.
Now tests run light, no secrets leaked—
The warren’s safe, the coverage peaked!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62d395d and 9333f8a.

📒 Files selected for processing (1)
  • src/main/java/com/pinback/pinback_server/global/config/swagger/SwaggerConfig.java (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/main/java/com/pinback/pinback_server/global/config/swagger/SwaggerConfig.java
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

Copy link
Contributor

@ose0221 ose0221 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 !

@rootTiket rootTiket merged commit 5ecb219 into dev Jul 17, 2025
5 checks passed
@rootTiket rootTiket deleted the refactor/#83 branch July 17, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants