MCPcopy Create free account
hub / github.com/github/gh-aw / TestEnsureSingleSelectOptionBefore

Function TestEnsureSingleSelectOptionBefore

pkg/cli/project_command_test.go:243–330  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

241}
242
243func TestEnsureSingleSelectOptionBefore(t *testing.T) {
244 tests := []struct {
245 name string
246 options []singleSelectOption
247 desired singleSelectOption
248 beforeName string
249 expectChanged bool
250 expectedLength int
251 }{
252 {
253 name: "add new option before Done",
254 options: []singleSelectOption{
255 {Name: "Todo", Color: "GRAY"},
256 {Name: "In Progress", Color: "YELLOW"},
257 {Name: "Done", Color: "GREEN"},
258 },
259 desired: singleSelectOption{Name: "Review Required", Color: "BLUE", Description: "Needs review"},
260 beforeName: "Done",
261 expectChanged: true,
262 expectedLength: 4,
263 },
264 {
265 name: "option already exists in correct position",
266 options: []singleSelectOption{
267 {Name: "Todo", Color: "GRAY"},
268 {Name: "In Progress", Color: "YELLOW"},
269 {Name: "Review Required", Color: "BLUE", Description: "Needs review"},
270 {Name: "Done", Color: "GREEN"},
271 },
272 desired: singleSelectOption{Name: "Review Required", Color: "BLUE", Description: "Needs review"},
273 beforeName: "Done",
274 expectChanged: false,
275 expectedLength: 4,
276 },
277 {
278 name: "option exists but in wrong position",
279 options: []singleSelectOption{
280 {Name: "Review Required", Color: "BLUE", Description: "Needs review"},
281 {Name: "Todo", Color: "GRAY"},
282 {Name: "In Progress", Color: "YELLOW"},
283 {Name: "Done", Color: "GREEN"},
284 },
285 desired: singleSelectOption{Name: "Review Required", Color: "BLUE", Description: "Needs review"},
286 beforeName: "Done",
287 expectChanged: true,
288 expectedLength: 4,
289 },
290 {
291 name: "beforeName option does not exist - appends to end",
292 options: []singleSelectOption{
293 {Name: "Todo", Color: "GRAY"},
294 {Name: "In Progress", Color: "YELLOW"},
295 },
296 desired: singleSelectOption{Name: "Review Required", Color: "BLUE", Description: "Needs review"},
297 beforeName: "NonExistent",
298 expectChanged: true,
299 expectedLength: 3,
300 },

Callers

nothing calls this directly

Calls 2

RunMethod · 0.45

Tested by

no test coverage detected