Skip to content

Commit 6aa6026

Browse files
committed
Test type-morphing of Object to Object
1 parent 6fd7049 commit 6aa6026

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

manifest/morph/morph_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,33 @@ func TestMorphValueToType(t *testing.T) {
288288
"three": tftypes.NewValue(tftypes.String, "baz"),
289289
}),
290290
},
291+
"object->object": {
292+
In: sampleInType{
293+
V: tftypes.NewValue(tftypes.Object{AttributeTypes: map[string]tftypes.Type{
294+
"one": tftypes.String,
295+
"two": tftypes.String,
296+
"three": tftypes.String,
297+
}}, map[string]tftypes.Value{
298+
"one": tftypes.NewValue(tftypes.String, "foo"),
299+
"two": tftypes.NewValue(tftypes.String, "bar"),
300+
"three": tftypes.NewValue(tftypes.String, "baz"),
301+
}),
302+
T: tftypes.Object{AttributeTypes: map[string]tftypes.Type{
303+
"one": tftypes.String,
304+
"two": tftypes.String,
305+
"three": tftypes.String,
306+
}},
307+
},
308+
Out: tftypes.NewValue(tftypes.Object{AttributeTypes: map[string]tftypes.Type{
309+
"one": tftypes.String,
310+
"two": tftypes.String,
311+
"three": tftypes.String,
312+
}}, map[string]tftypes.Value{
313+
"one": tftypes.NewValue(tftypes.String, "foo"),
314+
"two": tftypes.NewValue(tftypes.String, "bar"),
315+
"three": tftypes.NewValue(tftypes.String, "baz"),
316+
}),
317+
},
291318

292319
// Testcases to demonstrate https://github.com/hashicorp/terraform-provider-kubernetes-alpha/issues/190
293320
"string(unknown value)->string": {

0 commit comments

Comments
 (0)