test(linear): add unit tests for Linear trigger handlers#1101
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Apr 14, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
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 conditionshandle()state→agent mapping viaSTATUS_TO_AGENT- Null returns for missing config, disabled triggers, missing identifiers
- Fallback from
identifiertoidfor workItemId - Comment-mention self-authored guard and bot @mention detection
checkTriggerEnabledcalled with correct arguments per agent type
Minor observations (not blocking):
noLinearConfigparameter is declared inlinear-status-changed.test.ts'sbuildCtxbut never used in any test case — the source usesgetLinearConfig()(mocked separately), notproject.linear. Dead code in the helper, but harmless.- The last two tests in
linear-comment-mention.test.ts(includes linearIssueIdanduses 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LinearStatusChangedTriggercovering matches/non-match cases and handle outcomes (status→agent mapping, trigger enabled/disabled, null conditions)LinearReadyToProcessLabelTriggercovering matches (label name/id, custom labels, missing fields) and handle (state→agent mapping, null conditions)LinearCommentMentionTriggercovering 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 coveringmatches(source, action, type, updatedFrom) andhandle(agent mapping, null cases, trigger toggle, agentInput fields)LinearReadyToProcessLabelTrigger: 22 tests coveringmatches(source, action, type, label name/id) andhandle(agent mapping, null cases, trigger toggle, agentInput fields)LinearCommentMentionTrigger: 19 tests coveringmatches(source, action, type) andhandle(mention detection, self-authored guard, bot ID resolution)🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details