test: add unit tests for agent, API routes, and validators#229
Open
ToddHebebrand wants to merge 3 commits intomainfrom
Open
test: add unit tests for agent, API routes, and validators#229ToddHebebrand wants to merge 3 commits intomainfrom
ToddHebebrand wants to merge 3 commits intomainfrom
Conversation
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>
- 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>
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
Test plan
test-agentjob passes (Go tests with-race)test-apijob passes (Vitest API tests)test-webjob passes (no regressions)🤖 Generated with Claude Code