(t *testing.T)
| 241 | } |
| 242 | |
| 243 | func 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 | }, |
nothing calls this directly
no test coverage detected