Cover the live feed over a real socket and tighten both complexity ceilings - #61
Merged
Merged
Conversation
…ilings The WebSocket routes were the one surface no test reached: an upgrade needs a real connection underneath it, and the rest of the Go suite drives an in-memory transport. A second application on a loopback port now covers registration, fan-out to a watching page, and the drop on close. registerWebSockets goes from 43% to 93% covered and the package from 89% to 92%. gocyclo moves to -over 4 and the ESLint complexity cap to 5, each sitting at the worst score the tree now carries. Four functions lost a branch to get there: captureHeaders, handleListRequests, sendCustom, and the suite's request driver. Two more gaps close in Go: a capture whose stored headers will not marshal, and a client IP no source can parse. Screens are reached through getByTestId rather than an attribute selector spelled at every call site, with testIdAttribute pointing it at data-test. Three behaviours gain a test beside it: a body past the highlight ceiling, an arrival reaching the live region, and a sub-path sent without its leading slash.
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.
The WebSocket routes carried no test. An upgrade needs a real connection, and the Go suite drives an in-memory transport instead. This branch starts a second application on a loopback port and covers registration, fan-out and the drop on close. Both complexity ceilings also drop a level, to
gocyclo -over 4and ESLintcomplexity5.No runtime behaviour changes. Four functions each gained a helper so they could shed a branch. The Playwright suite now reads
data-testthroughgetByTestId. The three type assertions in the test harness stay: they sit atJSON.parseandresponse.json()boundaries, where TypeScript cannot know the shape.go test ./src/....go run github.com/fzipp/gocyclo/cmd/gocyclo@v0.6.0 -over 4 ./src.pnpm run lint.CGO_ENABLED=0 go build -o ./bin/httphq ./src.pnpm --filter httphq-e2e exec playwright test.