Mutation method updated to return new copy

with value node (pointer) and value (non pointer) returned.
This commit is contained in:
Dave Shanley
2022-09-13 09:32:08 -04:00
parent a2b7119af7
commit aa4422fa74
4 changed files with 167 additions and 177 deletions

View File

@@ -160,7 +160,12 @@ func TestDocument_Serialize_JSON_Modified(t *testing.T) {
v3Doc, _ := doc.BuildV3Document()
v3Doc.Model.Info.GoLow().Title.Mutate("The magic API - but now, altered!")
// eventually this will be encapsulated up high.
// mutation does not replace low model, eventually pointers will be used.
newTitle := v3Doc.Model.Info.GoLow().Title.Mutate("The magic API - but now, altered!")
v3Doc.Model.Info.GoLow().Title = newTitle
assert.Equal(t, "The magic API - but now, altered!", v3Doc.Model.Info.GoLow().Title.Value)
serial, err := doc.Serialize()
assert.NoError(t, err)