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

Function Test_selectManualTitleTurnIndexes

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

Source from the content-addressed store, hash-verified

89}
90
91func Test_selectManualTitleTurnIndexes(t *testing.T) {
92 t.Parallel()
93
94 tests := []struct {
95 name string
96 turns []manualTitleTurn
97 want []int
98 }{
99 {
100 name: "single user turn",
101 turns: []manualTitleTurn{
102 {role: "user", text: "one"},
103 },
104 want: []int{0},
105 },
106 {
107 name: "first user plus trailing window",
108 turns: []manualTitleTurn{
109 {role: "user", text: "one"},
110 {role: "assistant", text: "two"},
111 {role: "user", text: "three"},
112 {role: "assistant", text: "four"},
113 {role: "user", text: "five"},
114 },
115 want: []int{0, 2, 3, 4},
116 },
117 {
118 name: "two turns returns both",
119 turns: []manualTitleTurn{
120 {role: "user", text: "one"},
121 {role: "assistant", text: "two"},
122 },
123 want: []int{0, 1},
124 },
125 {
126 name: "prepends first user when before trailing window",
127 turns: []manualTitleTurn{
128 {role: "assistant", text: "intro"},
129 {role: "assistant", text: "setup"},
130 {role: "user", text: "goal"},
131 {role: "assistant", text: "a"},
132 {role: "assistant", text: "b"},
133 {role: "assistant", text: "c"},
134 },
135 want: []int{2, 3, 4, 5},
136 },
137 {
138 name: "ten plus turns keeps first user and last three",
139 turns: []manualTitleTurn{
140 {role: "assistant", text: "0"},
141 {role: "assistant", text: "1"},
142 {role: "user", text: "2"},
143 {role: "assistant", text: "3"},
144 {role: "assistant", text: "4"},
145 {role: "assistant", text: "5"},
146 {role: "assistant", text: "6"},
147 {role: "assistant", text: "7"},
148 {role: "assistant", text: "8"},

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected