Skip to content

test: cover domain requirements and claims - #30

Merged
patramsey merged 1 commit into
mainfrom
test/domain-requirements
Aug 2, 2026
Merged

test: cover domain requirements and claims#30
patramsey merged 1 commit into
mainfrom
test/domain-requirements

Conversation

@patramsey

Copy link
Copy Markdown
Owner

runClaims and joinYears were at 0.0%, runRequirements at 56.2% — the file overall 25.7% → 90.5%.

These are the commands that tell someone what a registry demands before they try to register, so being wrong here surfaces as a failed registration rather than as a bad-looking table.

Function Before After
runRequirements 56.2% 87.5%
runClaims 0.0% 90.9%
joinYears 0.0% 100%

Repo total: 67.2% → 68.3%.

What the 29 cases pin

  • TLD canonicalized into the request path (" FR "fr). The API wants it bare, lowercase, ASCII; .FR 404s.
  • Blank TLD rejected before any HTTP call, asserted against a server that fails the test if it's contacted at all.
  • Quiet mode lists required field names, sorted. Sorting isn't cosmetic — Go randomizes map iteration, so unsorted output differs run to run and nothing built on it is reproducible. The test asserts exact order.
  • Quiet mode prints nothing when a TLD requires no fields, rather than echoing the TLD back.
  • The capability table renders both a true and a false flag, so a badge stuck on one value can't pass.
  • The table keeps its -o json and --tld-requirement pointers. Without them the nested requirements are unreachable from the default view — which is the entire reason they're printed as a hint instead of flattened into a misleading table.
  • claimId: "" counts as unclaimed, not claimed. That distinction decides whether someone is told to pass --acknowledge-claim.
  • An inactive claims process is stated explicitly — "no claims found" means something different when nothing was actually checked.
  • JSON and YAML carry the nested requirements and the claim id, and omit the human hint.
  • A 404 surfaces the API's message.

Verification

Seven mutations, all caught:

Mutation
Drop sort.Strings in quiet mode
Change joinYears empty placeholder
Change joinYears separator
Treat non-nil empty claimId as claimed
Invert the inactive-claims-process notice
Skip TLD canonicalization
Silence the quiet-mode claim id
  • 29 subtests confirmed running (not silently skipped) via -v
  • golangci-lint run — no issues
  • go test -race -count=1 ./... — full suite clean
  • go vet ./... clean

Remaining, if you want to keep going

cmd/dns, cmd/url, cmd/email sit at ~66–71% with the same shape of gap — error paths the existing stubs never drive. That's mechanical volume work rather than thinking work.

Still worth an explicit decision rather than drift: cmd/help.go, cmd/cmdutil/complete.go and internal/update are 0% but are help text, shell completion, and a network version check — roughly 6 points of badge for very little confidence.

runClaims and joinYears were at 0.0% and runRequirements at 56.2% — the
whole file 25.7%, now 90.5%. These are the commands that tell someone
what a registry demands before they try to register, so being wrong here
surfaces as a failed registration rather than as a bad table.

29 cases. What they pin, and why each one is worth a test:

- The TLD is canonicalized into the request path ("  FR  " -> "fr"). The
  API wants it bare, lowercase and ASCII; ".FR" 404s.
- A blank TLD is rejected before any HTTP call, against a server that
  fails the test if contacted.
- Quiet mode lists the required *field names*, sorted. Sorting is not
  cosmetic: Go randomizes map iteration, so unsorted output differs run
  to run and nothing built on it is reproducible. The test asserts exact
  order, and dropping sort.Strings fails it.
- Quiet mode prints nothing when a TLD requires no fields, rather than
  echoing the TLD back.
- The capability table renders both a true and a false flag, so a badge
  stuck on one value cannot pass.
- The table keeps its pointers to `-o json` and `--tld-requirement`;
  without them the nested requirements are unreachable from the default
  view, which is the whole reason they are printed as a hint.
- claimId "" counts as unclaimed, not claimed. The distinction decides
  whether someone is told to pass --acknowledge-claim.
- An inactive claims process is stated explicitly — "no claims found"
  means something different when nothing was checked.
- JSON and YAML carry the nested requirements and the claim id, and omit
  the human hint.
- A 404 surfaces the API's message.

Verified by mutation, seven of them, all caught: dropping the sort,
changing joinYears' empty placeholder and its separator, treating a
non-nil empty claimId as claimed, inverting the claims-process notice,
skipping canonicalization, and silencing the quiet-mode claim id.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@patramsey
patramsey merged commit 62008bc into main Aug 2, 2026
3 checks passed
@patramsey
patramsey deleted the test/domain-requirements branch August 2, 2026 20:31
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.

2 participants