Skip to content

Commit eace59e

Browse files
committed
test: name the unknown-subcommand case after the behaviour it checks
The test name and its comment described where the case came from rather than what it asserts. Renamed to state the condition it covers - an unknown subcommand with no near match - so the name survives independent of its origin story.
1 parent 1f1f020 commit eace59e

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

internal/cli/group_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ func TestCommandUnknownSubcommandFailsLoudly(t *testing.T) {
4343
}
4444
}
4545

46-
// TestCommandUnknownSubcommandReportedFromAudit reproduces the exact repro
47-
// from the production audit: an AI-SRE session guessed "incident
48-
// list-alerts" instead of the real "incident alerts" subcommand. The typo is
49-
// too far (by both edit-distance and prefix) from any real subcommand name
50-
// for cobra's SuggestionsFor to produce a match, so this only asserts the
51-
// core fix — non-zero exit, clearly-labeled unknown command — not a
46+
// TestCommandUnknownSubcommandWithNoNearMatchStillFails covers a plausible
47+
// but wrong guess — "incident list-alerts" for the real "incident alerts".
48+
// It is too far from any real subcommand name, by both edit distance and
49+
// prefix, for cobra's SuggestionsFor to match, so this asserts only the core
50+
// guarantee: non-zero exit and a clearly-labeled unknown command, with no
5251
// suggestion. See TestCommandUnknownSubcommandFailsLoudly for the
5352
// suggestion-bearing case.
54-
func TestCommandUnknownSubcommandReportedFromAudit(t *testing.T) {
53+
func TestCommandUnknownSubcommandWithNoNearMatchStillFails(t *testing.T) {
5554
saveAndResetGlobals(t)
5655

5756
_, err := execCommand("incident", "list-alerts")

0 commit comments

Comments
 (0)