(t *testing.T)
| 63 | } |
| 64 | |
| 65 | func TestApplyValueMap(t *testing.T) { |
| 66 | tests := []struct { |
| 67 | name string |
| 68 | val string |
| 69 | m map[string]string |
| 70 | want string |
| 71 | }{ |
| 72 | {"exact match", "postgres", map[string]string{"postgres": "PostgreSQL"}, "PostgreSQL"}, |
| 73 | {"case-insensitive", "POSTGRES", map[string]string{"postgres": "PostgreSQL"}, "PostgreSQL"}, |
| 74 | {"no match passthrough", "mariadb-custom", map[string]string{"postgres": "PostgreSQL"}, "mariadb-custom"}, |
| 75 | {"boolean true", "true", map[string]string{"true": "Multi-AZ", "false": "Single-AZ"}, "Multi-AZ"}, |
| 76 | {"boolean false", "false", map[string]string{"true": "Multi-AZ", "false": "Single-AZ"}, "Single-AZ"}, |
| 77 | {"engine redis", "redis", map[string]string{"redis": "Redis", "memcached": "Memcached"}, "Redis"}, |
| 78 | {"engine Redis caps", "Redis", map[string]string{"redis": "Redis", "memcached": "Memcached"}, "Redis"}, |
| 79 | {"empty map", "val", map[string]string{}, "val"}, |
| 80 | } |
| 81 | |
| 82 | for _, tt := range tests { |
| 83 | t.Run(tt.name, func(t *testing.T) { |
| 84 | got := awsdecode.ApplyValueMap(tt.val, tt.m) |
| 85 | if got != tt.want { |
| 86 | t.Errorf("applyValueMap(%q) = %q, want %q", tt.val, got, tt.want) |
| 87 | } |
| 88 | }) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func TestDecodeRDSWithValueMapping(t *testing.T) { |
| 93 | records := []resources.ResourceRecord{ |
nothing calls this directly
no outgoing calls
no test coverage detected