(t *testing.T)
| 353 | } |
| 354 | |
| 355 | func TestParseConfigFormat(t *testing.T) { |
| 356 | tests := []struct { |
| 357 | name string |
| 358 | defaultFormat string |
| 359 | expected string |
| 360 | }{ |
| 361 | {"", FormatInvalid, FormatInvalid}, |
| 362 | {"", FormatJSON, FormatJSON}, |
| 363 | {"application/json", FormatInvalid, FormatJSON}, |
| 364 | {"application/yaml", FormatInvalid, FormatYAML}, |
| 365 | {"application/json, application/yaml", FormatInvalid, FormatJSON}, |
| 366 | {"application/yaml, application/json", FormatInvalid, FormatYAML}, |
| 367 | {"text/plain, application/yaml", FormatInvalid, FormatYAML}, |
| 368 | {"application/yaml; a=1", FormatInvalid, FormatYAML}, |
| 369 | } |
| 370 | for _, test := range tests { |
| 371 | t.Run(test.name+"_"+test.expected, func(t *testing.T) { |
| 372 | actual := parseConfigFormat(test.name, test.defaultFormat) |
| 373 | assert.Equal(t, test.expected, actual) |
| 374 | }) |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | func Test_SetConfig_ValidateTemplateFiles(t *testing.T) { |
| 379 | cfg := userconfig.Config{ |
nothing calls this directly
no test coverage detected