(t *testing.T)
| 3589 | } |
| 3590 | |
| 3591 | func TestPathValues_GetOr(t *testing.T) { |
| 3592 | var testCases = []struct { |
| 3593 | name string |
| 3594 | whenKey string |
| 3595 | whenDefaultValue string |
| 3596 | expect string |
| 3597 | }{ |
| 3598 | { |
| 3599 | name: "ok, existing key", |
| 3600 | whenKey: `tag`, |
| 3601 | whenDefaultValue: `tag`, |
| 3602 | expect: `latest`, |
| 3603 | }, |
| 3604 | { |
| 3605 | name: "nok, no existing key return default value", |
| 3606 | whenKey: `not existent key`, |
| 3607 | whenDefaultValue: `ok`, |
| 3608 | expect: "ok", |
| 3609 | }, |
| 3610 | } |
| 3611 | for _, tc := range testCases { |
| 3612 | t.Run(tc.name, func(t *testing.T) { |
| 3613 | pv := PathValues{ |
| 3614 | {Name: "image", Value: "docker"}, |
| 3615 | {Name: "tag", Value: "latest"}, |
| 3616 | } |
| 3617 | |
| 3618 | result := pv.GetOr(tc.whenKey, tc.whenDefaultValue) |
| 3619 | assert.Equal(t, tc.expect, result) |
| 3620 | }) |
| 3621 | } |
| 3622 | } |
| 3623 | |
| 3624 | func BenchmarkRouterStaticRoutes(b *testing.B) { |
| 3625 | benchmarkRouterRoutes(b, staticRoutes, staticRoutes) |
nothing calls this directly
no test coverage detected
searching dependent graphs…