Skip to content

test(triggers): add integration tests for trigger config resolver#924

Merged
aaight merged 1 commit intodevfrom
feature/trigger-config-resolver-integration-tests
Mar 16, 2026
Merged

test(triggers): add integration tests for trigger config resolver#924
aaight merged 1 commit intodevfrom
feature/trigger-config-resolver-integration-tests

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 16, 2026

Summary

  • Adds tests/integration/trigger-config-resolver.test.ts with 26 integration tests covering the full resolution chain for trigger configurations
  • Tests verify definition defaults → DB overrides → merged output for all four exported resolver functions
  • Tests the isTriggerEnabled, getTriggerParameters, resolveTriggerConfigs, and getResolvedTriggerConfig functions end-to-end against a real test database

What was implemented

  • isTriggerEnabled() — 7 tests: returns definition default (true/false), DB override wins (true/false), agent-not-enabled gate, unknown agent type, unknown trigger event
  • getTriggerParameters() — 7 tests: definition defaults, empty params, DB override wins, parameter merging (DB wins on conflicts + adds new keys), agent-not-enabled gate, unknown agent/trigger
  • resolveTriggerConfigs() — 6 tests: all triggers with defaults, isCustomized flag, agent-not-enabled, unknown agent, no-trigger definition, multi-trigger DB override merging
  • getResolvedTriggerConfig() — 6 tests: known event (no DB), known event (with DB override), null for unknown event, null when agent not enabled, null for unknown agent, description/providers from definition

Test approach

  • Seeds a custom test-resolver-agent definition into the DB for each test, avoiding dependency on built-in YAML definitions
  • Calls clearDefinitionCache() in beforeEach to prevent stale cache state between tests
  • Uses existing seedAgentDefinition, seedAgentConfig, seedTriggerConfig helpers from tests/integration/helpers/seed.ts
  • Uses truncateAll() in beforeEach for test isolation

Test plan

  • All 26 new integration tests pass
  • All 5422 existing unit tests pass
  • Lint clean (biome check --write . — no fixes applied)
  • TypeScript type check clean (tsc --noEmit — no errors)

Trello: https://trello.com/c/69b8008fa6ab955c5b3f814b

🤖 Generated with Claude Code

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

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.

LGTM — well-structured integration tests that thoroughly cover the trigger config resolution chain (definition defaults → DB overrides → merged output) across all four exported functions. Test isolation is solid (truncateAll + clearDefinitionCache in beforeEach), fixtures are self-contained with a custom agent type to avoid coupling to built-in YAMLs, and edge cases (unknown agent/trigger, agent-not-enabled gate) are all covered. All CI checks pass.

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

@aaight aaight merged commit 47346e9 into dev Mar 16, 2026
6 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