Skip to content

test: add unit tests for agent, API routes, and validators#229

Open
ToddHebebrand wants to merge 3 commits intomainfrom
test/add-unit-tests
Open

test: add unit tests for agent, API routes, and validators#229
ToddHebebrand wants to merge 3 commits intomainfrom
test/add-unit-tests

Conversation

@ToddHebebrand
Copy link
Collaborator

Summary

  • Add 30 Go agent test files covering backup, discovery, filetransfer, httputil, monitoring, mtls, peripheral, privilege, scripts, snmppoll, terminal, and websocket packages
  • Add 27 API route test files covering agents, AI, audit baselines, browser security, CIS hardening, custom fields, deployments, desktop WS, dev push, enrollment keys, filters, groups, monitoring, monitors, network baselines/changes/shared, notifications, policy management, script AI, software inventory, system, tags, terminal WS, and update rings
  • Add 4 shared validator test files for AI, filters, index-extended, and reliability schemas

Test plan

  • CI test-agent job passes (Go tests with -race)
  • CI test-api job passes (Vitest API tests)
  • CI test-web job passes (no regressions)
  • Verify no test file exceeds 500-line limit (declarative test data excluded)

🤖 Generated with Claude Code

Add 61 test files covering Go agent internals (backup, discovery,
filetransfer, httputil, monitoring, mtls, peripheral, privilege,
scripts, snmppoll, terminal, websocket), API route handlers, and
shared validator schemas.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 14, 2026

Deploying breeze with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7a366ef
Status:🚫  Build failed.

View logs

ToddHebebrand and others added 2 commits March 14, 2026 21:17
- Split 32 oversized test files (500+ lines) into ~90 focused files
  under the CLAUDE.md 500-line limit
- Fix vi.mock factory hoisting in 11 API test files — replace
  module-level const references with literal values
- Add multi-tenant isolation tests to 9 API route files that were
  missing cross-org access denied coverage
- Consolidate 8 individual MaybeAutoRestart tests into 1 table-driven
  test (Go convention per CLAUDE.md)
- Remove 3 non-behavioral tests: TestBackupJob_Fields (struct
  assignment), TestJobStatusConstants (constant values),
  TestWatchStateKeyFormat (string concatenation)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix vi.mock hoisting in 33 files (96 replacements) — all module-level
  const references inside vi.mock factories replaced with literals
- Add multi-tenant isolation tests to 5 remaining file groups:
  cisHardening, desktopWs, softwareInventory, system, terminalWs
- Split scriptAi.test.ts (535 lines) into 2 files
- Split enrollmentKeys.test.ts (526 lines) into 2 files
- Zero vi.mock hoisting violations remaining
- Zero files from this PR over 500-line limit
- All 9 originally flagged file groups now have multi-tenant tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant