Skip to content

test(controller): improve Account and Contact controller unit test coverage #56

@joelp172

Description

@joelp172

Summary

Account and Contact controllers have minimal unit test coverage — only basic reconciliation is tested. Error paths, edge cases, and failure scenarios are not covered.

Current Behaviour

  • Account controller: basic reconciliation test only
  • Contact controller: basic reconciliation test only
  • No tests for API key validation failures, secret not found, contact name resolution failures

Proposed Test Cases

Account Controller

  • API key secret not found
  • API key secret has wrong key
  • GetAccountDetails API error (transient)
  • GetAccountDetails API error (auth failure)
  • Alert contacts fetch failure (should be non-blocking)
  • Multiple accounts with isDefault conflict
  • Account update triggers re-validation
  • Status fields correctly populated from API response

Contact Controller

  • Contact ID lookup success
  • Contact name lookup success
  • Contact name not found in UptimeRobot
  • Multiple contacts with same name
  • Account reference not ready
  • Account reference not found
  • API error during contact resolution

Acceptance Criteria

  • Unit test coverage >80% for both controllers
  • All error paths tested
  • Edge cases documented and covered
  • Tests pass in CI

Phase

P2 — Testing Gaps (Phase 2: Trust)

Metadata

Metadata

Labels

priority: mediumP2/P3 - Should havetestingTest coverage and CI improvements

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions