forked from sourcenetwork/defradb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
418d3b2
commit 2905775
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
tests/integration/schema/updates/add/field/with_relation_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2024 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package field | ||
|
||
import ( | ||
"testing" | ||
|
||
testUtils "github.com/sourcenetwork/defradb/tests/integration" | ||
) | ||
|
||
func TestSchemaUpdatesAddField_DoesNotAffectExistingRelation(t *testing.T) { | ||
test := testUtils.TestCase{ | ||
Actions: []any{ | ||
testUtils.SchemaUpdate{ | ||
Schema: ` | ||
type Book { | ||
name: String | ||
author: Author | ||
} | ||
type Author { | ||
name: String | ||
books: [Book] | ||
} | ||
`, | ||
}, | ||
testUtils.SchemaPatch{ | ||
Patch: ` | ||
[ | ||
{ "op": "add", "path": "/Book/Fields/-", "value": {"Name": "rating", "Kind": 4} } | ||
] | ||
`, | ||
ExpectedError: "mutating an existing field is not supported.", | ||
}, | ||
}, | ||
} | ||
testUtils.ExecuteTestCase(t, test) | ||
} |