test(inspect): split oversized test files for clarity#13
Merged
Conversation
Mechanical refactor for code clarity. check_test.go (2997 LOC) split into three same-package files at top-level function boundaries with no behavior, API, or exported-symbol changes: - check_test.go (1130 LOC): shared makePage helper + core check tests - check_more_test.go (972 LOC): registry and per-check unit tests - check_extra_test.go (920 LOC): interface conformance, edge cases, helpers
Mechanical refactor for code clarity. crawler_test.go (1549 LOC) split into two same-package files at a top-level function boundary with no behavior, API, or exported-symbol changes: - crawler_test.go (774 LOC): crawl, rate limiter, robots, resolve tests - crawler_more_test.go (790 LOC): auth, redirect, SSRF, page, ctor tests
Mechanical refactor for code clarity. mcp/server_test.go (1314 LOC) split into two same-package files at a top-level function boundary with no behavior, API, or exported-symbol changes. Shared test helpers remain in server_test.go: - server_test.go (648 LOC): helpers, protocol, scan, scandir, error tests - server_more_test.go (689 LOC): session, concurrency, auth, timeout tests
Mechanical follow-up to keep every check test file under 1000 LOC. Moves the ARIA / landmarks / advanced-a11y tests verbatim out of check_test.go into a focused same-package file. No behavior, API, or exported-symbol changes: - check_test.go (700 LOC) - check_a11y_test.go (441 LOC)
90b42a0 to
f595919
Compare
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
Pure mechanical refactor for code clarity only — splits oversized Go test files (>1000 LOC) into smaller, same-package files. Code was moved verbatim at top-level function boundaries. No behavior, API, or exported-symbol changes. Shared helpers/consts were left in a file all same-package callers can still reach.
Files split (before → after LOC)
internal/check/check_test.gocheck_test.gocheck_a11y_test.go(ARIA/landmarks/advanced-a11y)check_more_test.go(registry + per-check unit tests)check_extra_test.go(interface conformance, edge cases, helpers)internal/crawler/crawler_test.gocrawler_test.gocrawler_more_test.go(auth/redirect/SSRF/page/ctor)mcp/server_test.goserver_test.go(helpers + protocol/scan/error)server_more_test.go(session/concurrency/auth/timeout)Shared test helpers (
makePage,jsonRPCRequest,newTestHTTPServer, etc.) remain in the original files; all moved tests reference them within the same package.No main-module
.gofile remains over 1000 LOC. (Thebrowser/directory is a separate Go module and was not touched.)Verification
All run with the repo toolchain (Go 1.26.4; no cgo required):
goimports -won every touched filego build ./...— cleango vet ./...— cleango test ./...— all packages passgolangci-lint runon each affected package — 0 issuesTest plan
go build ./...go vet ./...go test ./...golangci-lint run ./internal/check/ ./internal/crawler/ ./mcp/Made with Cursor