Skip to content

test(inspect): split oversized test files for clarity#13

Merged
Patel230 merged 4 commits into
mainfrom
refactor/code-clarity
Jun 19, 2026
Merged

test(inspect): split oversized test files for clarity#13
Patel230 merged 4 commits into
mainfrom
refactor/code-clarity

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

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)

Original LOC Result files LOC
internal/check/check_test.go 2997 check_test.go 700
check_a11y_test.go (ARIA/landmarks/advanced-a11y) 441
check_more_test.go (registry + per-check unit tests) 972
check_extra_test.go (interface conformance, edge cases, helpers) 920
internal/crawler/crawler_test.go 1549 crawler_test.go 774
crawler_more_test.go (auth/redirect/SSRF/page/ctor) 790
mcp/server_test.go 1314 server_test.go (helpers + protocol/scan/error) 648
server_more_test.go (session/concurrency/auth/timeout) 689

Shared test helpers (makePage, jsonRPCRequest, newTestHTTPServer, etc.) remain in the original files; all moved tests reference them within the same package.

No main-module .go file remains over 1000 LOC. (The browser/ 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 -w on every touched file
  • go build ./... — clean
  • go vet ./... — clean
  • go test ./... — all packages pass
  • golangci-lint run on each affected package — 0 issues

Test plan

  • go build ./...
  • go vet ./...
  • go test ./...
  • golangci-lint run ./internal/check/ ./internal/crawler/ ./mcp/

Made with Cursor

Patel230 added 4 commits June 19, 2026 20:59
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)
@Patel230 Patel230 force-pushed the refactor/code-clarity branch from 90b42a0 to f595919 Compare June 19, 2026 15:34
@Patel230 Patel230 merged commit 4f2b727 into main Jun 19, 2026
11 checks passed
@Patel230 Patel230 deleted the refactor/code-clarity branch June 19, 2026 17:12
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