test: few more correlatedobject test cases

This commit is contained in:
Alexander Zielenski 2023-10-11 15:45:48 -07:00
parent ba9347230e
commit 0149c1f8b3

View File

@ -238,6 +238,64 @@ func TestCorrelation(t *testing.T) {
NewValue: "b",
OldValue: "oldB",
},
{
Name: "Replaced Key In Old Object",
RootObject: map[string]interface{}{
"a": "b",
},
RootOldObject: map[string]interface{}{
"b": "a",
},
Schema: mustSchema(`
properties:
a: { type: string }
`),
KeyPath: []interface{}{},
NewValue: map[string]interface{}{"a": "b"},
OldValue: map[string]interface{}{"b": "a"},
},
{
Name: "Added Key In Old Object",
RootObject: map[string]interface{}{
"a": "b",
},
RootOldObject: map[string]interface{}{},
Schema: mustSchema(`
properties:
a: { type: string }
`),
KeyPath: []interface{}{},
NewValue: map[string]interface{}{"a": "b"},
OldValue: map[string]interface{}{},
},
{
Name: "Changed list to map",
RootObject: map[string]interface{}{
"a": "b",
},
RootOldObject: []interface{}{"a", "b"},
Schema: mustSchema(`
properties:
a: { type: string }
`),
KeyPath: []interface{}{},
NewValue: map[string]interface{}{"a": "b"},
OldValue: []interface{}{"a", "b"},
},
{
Name: "Changed string to map",
RootObject: map[string]interface{}{
"a": "b",
},
RootOldObject: "a string",
Schema: mustSchema(`
properties:
a: { type: string }
`),
KeyPath: []interface{}{},
NewValue: map[string]interface{}{"a": "b"},
OldValue: "a string",
},
{
Name: "Map list type",
RootObject: mustUnstructured(`