MCPcopy Index your code
hub / github.com/coder/coder / TestNormalizeTurnStatusLabel

Function TestNormalizeTurnStatusLabel

coderd/x/chatd/quickgen_internal_test.go:613–649  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

611}
612
613func TestNormalizeTurnStatusLabel(t *testing.T) {
614 t.Parallel()
615
616 tests := []struct {
617 name string
618 input string
619 want string
620 ok bool
621 }{
622 {name: "accepts short label", input: "Finished unit tests", want: "Finished unit tests", ok: true},
623 {name: "accepts two word label", input: "Submitted PR", want: "Submitted PR", ok: true},
624 {name: "trims quotes and trailing punctuation", input: `"Submitted PR."`, want: "Submitted PR", ok: true},
625 {name: "keeps version punctuation", input: "Updated v2.1 config", want: "Updated v2.1 config", ok: true},
626 {name: "accepts five word label", input: "Updated workspace proxy routing rules", want: "Updated workspace proxy routing rules", ok: true},
627 {name: "rejects agent phrasing", input: "Agent identified failing tests", ok: false},
628 {name: "rejects agent possessive", input: "Agent's findings reviewed", ok: false},
629 {name: "rejects i contraction", input: "I've fixed tests", ok: false},
630 {name: "rejects it contraction", input: "It's still running", ok: false},
631 {name: "rejects we contraction", input: "We're almost done", ok: false},
632 {name: "rejects agent phrase without prefix", input: "Found agent identified bugs", ok: false},
633 {name: "rejects chat phrasing", input: "The chat is waiting now", ok: false},
634 {name: "rejects multiline labels", input: "Fixed bug\nAdded tests", ok: false},
635 {name: "rejects multi sentence labels", input: "Fixed bug. Added tests", ok: false},
636 {name: "rejects single word", input: "Fixed", ok: false},
637 {name: "rejects long labels", input: "Fixed the bug and added tests", ok: false},
638 }
639
640 for _, tt := range tests {
641 t.Run(tt.name, func(t *testing.T) {
642 t.Parallel()
643
644 got, ok := normalizeTurnStatusLabel(tt.input)
645 require.Equal(t, tt.ok, ok)
646 require.Equal(t, tt.want, got)
647 })
648 }
649}
650
651func TestFallbackTurnStatusLabel(t *testing.T) {
652 t.Parallel()

Callers

nothing calls this directly

Calls 3

normalizeTurnStatusLabelFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected