Skip to content

test(linear): add unit tests for Linear trigger handlers#1101

Merged
aaight merged 1 commit intodevfrom
feature/linear-unit-tests
Apr 14, 2026
Merged

test(linear): add unit tests for Linear trigger handlers#1101
aaight merged 1 commit intodevfrom
feature/linear-unit-tests

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Apr 14, 2026

Summary

  • Add unit tests for LinearStatusChangedTrigger covering matches/non-match cases and handle outcomes (status→agent mapping, trigger enabled/disabled, null conditions)
  • Add unit tests for LinearReadyToProcessLabelTrigger covering matches (label name/id, custom labels, missing fields) and handle (state→agent mapping, null conditions)
  • Add unit tests for LinearCommentMentionTrigger covering matches and handle (bot mention detection, self-authored guard, bot ID resolution, trigger enabled/disabled)

Closes: https://trello.com/c/hUqkmUHd/597-as-a-developer-i-want-unit-tests-for-the-linear-integration-so-that-correctness-is-verified-and-regressions-are-caught

Test plan

  • LinearStatusChangedTrigger: 20 tests covering matches (source, action, type, updatedFrom) and handle (agent mapping, null cases, trigger toggle, agentInput fields)
  • LinearReadyToProcessLabelTrigger: 22 tests covering matches (source, action, type, label name/id) and handle (agent mapping, null cases, trigger toggle, agentInput fields)
  • LinearCommentMentionTrigger: 19 tests covering matches (source, action, type) and handle (mention detection, self-authored guard, bot ID resolution)
  • All 7422 existing unit tests still pass
  • Type checking passes (zero errors)
  • Lint passes (zero errors, 2 pre-existing warnings in unrelated files)

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

Summary

LGTM — Well-structured unit tests for the three Linear trigger handlers. Tests accurately reflect the source code behavior, cover the important paths (happy path, null guards, config missing, trigger disabled, fallback logic), and follow the project's established trigger test patterns.

The tests correctly verify:

  • matches() filtering on source, action, type, and handler-specific conditions
  • handle() state→agent mapping via STATUS_TO_AGENT
  • Null returns for missing config, disabled triggers, missing identifiers
  • Fallback from identifier to id for workItemId
  • Comment-mention self-authored guard and bot @mention detection
  • checkTriggerEnabled called with correct arguments per agent type

Minor observations (not blocking):

  • noLinearConfig parameter is declared in linear-status-changed.test.ts's buildCtx but never used in any test case — the source uses getLinearConfig() (mocked separately), not project.linear. Dead code in the helper, but harmless.
  • The last two tests in linear-comment-mention.test.ts (includes linearIssueId and uses issueId from data.issueId) exercise the same code path with the same value, making one redundant. Not worth changing.

CI is green. All 7422 existing tests still pass.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit ce958e5 into dev Apr 14, 2026
9 checks passed
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.

2 participants