Skip to content

[tidy] Fix linting issues in notify_comment_error.test.cjs#2026

Closed
dsyme wants to merge 1 commit intomainfrom
tidy-notify-comment-error-test-010bcdffba4cd18b
Closed

[tidy] Fix linting issues in notify_comment_error.test.cjs#2026
dsyme wants to merge 1 commit intomainfrom
tidy-notify-comment-error-test-010bcdffba4cd18b

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Oct 20, 2025

Summary

Fixed JavaScript linting issues in the test file notify_comment_error.test.cjs that were preventing the codebase from passing linting checks.

Changes Made

Fixed Duplicate Object Keys

  • Issue: Multiple test cases had duplicate body: keys in expect.objectContaining() calls, which is invalid JavaScript syntax
  • Solution: Converted to use expect.stringMatching() with regex patterns to match multiple string patterns in a single assertion

Specific Changes

  • Updated 7 test assertions from duplicate keys to regex patterns:
    • Success message: ✅.*completed successfully
    • Failure message: ❌.*failed.*wasn't able to produce a result
    • Cancelled message: 🚫.*was cancelled
    • Timeout message: ⏱️.*timed out
    • Skipped message: ⏭️.*was skipped
    • GraphQL success: ✅.*completed successfully
    • GraphQL failure: ❌.*failed

Validation

  • make fmt - All code properly formatted
  • make lint - All linting checks passing
  • make test - All tests passing (including the modified test file)
  • make recompile - All workflows recompiled successfully

Before & After

Before (Invalid - Duplicate Keys):

expect.objectContaining({
  owner: "testowner",
  repo: "testrepo",
  comment_id: 123456,
  body: expect.stringContaining("✅"),
  body: expect.stringContaining("completed successfully"), // Duplicate key!
})

After (Valid - Regex Pattern):

expect.objectContaining({
  owner: "testowner",
  repo: "testrepo",
  comment_id: 123456,
  body: expect.stringMatching(/.*completed successfully/s),
})

Impact

This change ensures the codebase passes all linting checks and maintains code quality standards. The test functionality remains identical - the assertions still verify the same behavior, just with cleaner syntax.

AI generated by Tidy

- Fixed duplicate body keys in expect.objectContaining() calls
- Changed to use expect.stringMatching() with regex patterns
- All tests passing and linting validated
@pelikhan pelikhan closed this Oct 20, 2025
@pelikhan pelikhan deleted the tidy-notify-comment-error-test-010bcdffba4cd18b branch October 23, 2025 21:24
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