Skip to content

test: 키워드 알림 테스트 코드 추가#2285

Open
Soundbar91 wants to merge 7 commits into
developfrom
test/2284-add-keyword-notification
Open

test: 키워드 알림 테스트 코드 추가#2285
Soundbar91 wants to merge 7 commits into
developfrom
test/2284-add-keyword-notification

Conversation

@Soundbar91

@Soundbar91 Soundbar91 commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

🔍 개요


🚀 주요 변경 내용

  • 이전 PR에서 포함시키지 못한 키워드 알림 테스트 코드를 추가했습니다.

💬 참고 사항


✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

Summary by CodeRabbit

  • Tests
    • Added test coverage for article keyword user matching, including proper handling of multiple keyword matches and keyword selection logic.
    • Added test coverage for keyword notification service to verify event publishing and user subscription handling.
    • Added reusable test fixtures for keyword and notification entities to support additional testing.

@Soundbar91 Soundbar91 self-assigned this Jun 6, 2026
@github-actions github-actions Bot added 공통 백엔드 공통으로 작업할 이슈입니다. 테스트 labels Jun 6, 2026
@github-actions github-actions Bot requested review from ImTotem and dh2906 June 6, 2026 12:19
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 40e5ef6b-1ad2-4f90-ba3c-06ed3ff361e5

📥 Commits

Reviewing files that changed from the base of the PR and between d9e8c95 and 32e0913.

📒 Files selected for processing (5)
  • src/test/java/in/koreatech/koin/unit/domain/community/keyword/service/ArticleKeywordUserMatcherTest.java
  • src/test/java/in/koreatech/koin/unit/domain/community/keyword/service/KeywordServiceTest.java
  • src/test/java/in/koreatech/koin/unit/domain/notification/service/KeywordNotificationServiceTest.java
  • src/test/java/in/koreatech/koin/unit/fixture/KeywordFixture.java
  • src/test/java/in/koreatech/koin/unit/fixture/NotificationFixture.java

📝 Walkthrough

Walkthrough

This PR adds a comprehensive unit test suite for the keyword notification feature across the entire pipeline: test fixtures for reusable test objects, matcher logic validation, service-layer event publishing coordination, and notification delivery verification.

Changes

Keyword Notification Test Suite

Layer / File(s) Summary
Test Fixtures for Keyword and Notification
src/test/java/in/koreatech/koin/unit/fixture/KeywordFixture.java, src/test/java/in/koreatech/koin/unit/fixture/NotificationFixture.java
Adds reusable factory methods for creating ArticleKeyword, ArticleKeywordUserMap, KoreatechArticleKeywordEvent, NotificationSubscribe, and Notification test objects.
ArticleKeywordUserMatcher Tests
src/test/java/in/koreatech/koin/unit/domain/community/keyword/service/ArticleKeywordUserMatcherTest.java
Tests keyword-to-user matching logic: repository querying with category and keyword filters, conversion to per-user keyword maps, selection of longest matching keywords, and deterministic tie-breaking when keywords have equal length.
KeywordService Tests
src/test/java/in/koreatech/koin/unit/domain/community/keyword/service/KeywordServiceTest.java
Tests sendKeywordNotification flow: article summary fetching by ID, keyword extraction and matching, user-keyword mapping, event publishing only for articles with matched users, and selective event emission across multiple articles.
KeywordNotificationService Tests
src/test/java/in/koreatech/koin/unit/domain/notification/service/KeywordNotificationServiceTest.java
Tests notifyArticleKeyword behavior: repository lookup for subscribers by matched user IDs, notification factory invocation per subscribed user-keyword pair, service call verification with expected notification lists, and skipping notification generation for non-subscribed users.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • BCSDLab/KOIN_API_V2#2237: New unit tests exercise the refactored keyword-notification flow and ArticleKeywordUserMatcher/KoreatechArticleKeywordEvent handling introduced in this PR.
  • BCSDLab/KOIN_API_V2#2268: KeywordServiceTest validates the flow change where sendKeywordNotification now operates on ArticleSummary read-model instead of full Article entities.
  • BCSDLab/KOIN_API_V2#2278: KeywordNotificationServiceTest directly verifies the NotificationService.pushNotifications call path modified in that PR.

Suggested labels

공통

Suggested reviewers

  • kih1015
  • dh2906
  • BaeJinho4028

🐰 Tests hop in with fixtures so fine,
Matchers line up keywords in a line,
Services coordinate the grand design,
Notifications flutter—all tests align! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding test code for keyword notifications, which matches the changeset contents of new test classes and fixtures for keyword notification functionality.
Linked Issues check ✅ Passed The PR successfully adds comprehensive test coverage for keyword notification functionality as required by issue #2284, including tests for ArticleKeywordUserMatcher, KeywordService, KeywordNotificationService, and test fixtures.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective of adding keyword notification test code; no unrelated or out-of-scope changes were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/2284-add-keyword-notification

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Unit Test Results

684 tests   681 ✔️  1m 20s ⏱️
171 suites      3 💤
171 files        0

Results for commit 32e0913.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

공통 백엔드 공통으로 작업할 이슈입니다. 테스트

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[공통] Keyword Notification 테스트 코드 추가

2 participants