Skip to content

test: add unit tests for CheckSummaryService#1525

Merged
pithva007 merged 1 commit into
nisshchayarathi:mainfrom
tmdeveloper007:1515-add-check-summary-tests
Jun 2, 2026
Merged

test: add unit tests for CheckSummaryService#1525
pithva007 merged 1 commit into
nisshchayarathi:mainfrom
tmdeveloper007:1515-add-check-summary-tests

Conversation

@tmdeveloper007
Copy link
Copy Markdown
Contributor

@tmdeveloper007 tmdeveloper007 commented May 31, 2026

Summary

  • Add unit tests for CheckSummaryService covering:
    • Success/failure summary generation
    • Warn status handling
    • Category name formatting
    • Action required status
    • Multiple evaluations

Closes #1515

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for summary generation functionality with comprehensive scenario testing, including policy output handling, status evaluations, and formatting validation.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

@tmdeveloper007 is attempting to deploy a commit to the Nisshchaya's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the GSSoC'26 Part of GirlScript Summer of Code 2026 label May 31, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces a comprehensive Jest test suite for the CheckSummaryService.generateSummary method, verifying its markdown and text output generation across multiple policy evaluation scenarios including success, failure, warnings, action-required status, and multi-evaluation handling.

Changes

CheckSummaryService generateSummary Tests

Layer / File(s) Summary
generateSummary method tests
lib/services/__tests__/check-summary.test.ts
Complete test suite covering generateSummary output fields (title, summary, text) and content generation across success scenarios, blocking/merge-blocked failures with reason formatting, WARN evaluations with indicators, action-required status handling, PASS message suppression, capitalization formatting, and multi-evaluation category-specific section rendering.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

level:intermediate, mentor:nisshchayarathi, GSSoC'26

Poem

🐰 A test suite hops into view,
Checking summaries through and through—
Successes, warnings, blocks, and more,
Formatting each evaluation's core!
Robust checks make code shine bright,
The service tested, left and right! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding unit tests for CheckSummaryService, which matches the actual code changes.
Linked Issues check ✅ Passed The PR successfully implements unit tests for CheckSummaryService.generateSummary() covering various evaluation outcomes and formatting cases as required by issue #1515.
Out of Scope Changes check ✅ Passed All changes are scoped to adding unit tests for CheckSummaryService; no unrelated modifications or out-of-scope changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions
Copy link
Copy Markdown

🎉 Thanks for your contribution, @tmdeveloper007!

Your PR has passed our automated GSSoC quality checks. Here's a quick summary:

Check Status
PR description ✅ Provided
PR title ✅ Meaningful
Linked issue ✅ Found
Change size ✅ Looks good (151 lines across 1 file(s))

A maintainer will review your PR soon. Please be patient and available for feedback. 💪

GSSoC'26 automation · Maintainer: @nisshchayarathi

1 similar comment
@github-actions
Copy link
Copy Markdown

🎉 Thanks for your contribution, @tmdeveloper007!

Your PR has passed our automated GSSoC quality checks. Here's a quick summary:

Check Status
PR description ✅ Provided
PR title ✅ Meaningful
Linked issue ✅ Found
Change size ✅ Looks good (151 lines across 1 file(s))

A maintainer will review your PR soon. Please be patient and available for feedback. 💪

GSSoC'26 automation · Maintainer: @nisshchayarathi

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
lib/services/__tests__/check-summary.test.ts (1)

32-52: 💤 Low value

Optionally assert the FAIL evaluation message is rendered.

The WARN test (Line 70) verifies the evaluation message surfaces for non-PASS statuses, but this FAIL case never asserts "Secret detected in code" appears in text. Adding it closes the symmetry and guards the FAIL rendering path.

♻️ Optional coverage addition
       expect(result.text).toContain("**Reason:**");
       expect(result.text).toContain("Security violations detected");
+      expect(result.text).toContain("Secret detected in code");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/services/__tests__/check-summary.test.ts` around lines 32 - 52, The FAIL
test in lib/services/__tests__/check-summary.test.ts should also assert that the
evaluation message is rendered: update the "should generate failure summary for
blocking policy" test that calls
CheckSummaryService.generateSummary(policyOutput) to include an expectation that
result.text contains the evaluation message "Secret detected in code" (similar
to the WARN test), ensuring the FAIL evaluation message from the evaluations
array is asserted.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lib/services/__tests__/check-summary.test.ts`:
- Around line 32-52: The FAIL test in
lib/services/__tests__/check-summary.test.ts should also assert that the
evaluation message is rendered: update the "should generate failure summary for
blocking policy" test that calls
CheckSummaryService.generateSummary(policyOutput) to include an expectation that
result.text contains the evaluation message "Secret detected in code" (similar
to the WARN test), ensuring the FAIL evaluation message from the evaluations
array is asserted.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7878e60c-3bcd-4661-a266-bb04c6a8666f

📥 Commits

Reviewing files that changed from the base of the PR and between acea063 and 2b9169f.

📒 Files selected for processing (1)
  • lib/services/__tests__/check-summary.test.ts

@pithva007 pithva007 merged commit 7578da4 into nisshchayarathi:main Jun 2, 2026
5 of 11 checks passed
@github-actions github-actions Bot added gssoc:approved level:beginner mentor:nisshchayarathi GSSoC: Mentor attribution for @nisshchayarathi labels Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC'26 Part of GirlScript Summer of Code 2026 level:beginner mentor:nisshchayarathi GSSoC: Mentor attribution for @nisshchayarathi

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for CheckSummaryService

2 participants