Skip to content

Commit

Permalink
Fix cids
Browse files Browse the repository at this point in the history
These were broken by the previous commit, changes split out to this commit to avoid cluttering the main change
  • Loading branch information
AndrewSisley committed Aug 26, 2024
1 parent be403c1 commit 7b33009
Show file tree
Hide file tree
Showing 53 changed files with 523 additions and 508 deletions.
2 changes: 1 addition & 1 deletion internal/db/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func TestBasicExport_WithMultipleCollectionsAndUpdate_NoError(t *testing.T) {
require.NoError(t, err)

expectedMap := map[string]any{}
data := []byte(`{"Book":[{"_docID":"bae-45c92e9c-4d31-5e96-8bd7-3d532734e117", "_docIDNew":"bae-3ca9a4c3-6240-5e86-a00f-9590d2f2ecf3", "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"John and the sourcerers' stone"}, {"_docID":"bae-8fc3d148-869b-5629-ae22-5423c73f709b", "_docIDNew":"bae-33c136bd-4375-54a0-81ff-54ca560c7bb8", "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"Game of chains"}], "User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d", "_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "age":31, "name":"John"}, {"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "age":31, "name":"Bob"}]}`)
data := []byte(`{"Book":[{"_docID":"bae-4a28c746-ccbf-5511-91a9-391036f42f80", "_docIDNew":"bae-d821f684-47de-5b63-b9c7-6eccec368e52", "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"Game of chains"}, {"_docID":"bae-8c8be5c6-d26b-50d4-9378-2acd5fe6959d", "_docIDNew":"bae-c94e52f8-6e91-522c-b6a6-38346a06b3d2", "author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "name":"John and the sourcerers' stone"}], "User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d", "_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f", "age":31, "name":"John"}, {"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f", "age":31, "name":"Bob"}]}`)
err = json.Unmarshal(data, &expectedMap)
require.NoError(t, err)
require.EqualValues(t, expectedMap, fileMap)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/backup/one_to_many/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestBackupExport_AllCollectionsMultipleDocsAndDocUpdate_NoError(t *testing.
Doc: `{"age": 31}`,
},
testUtils.BackupExport{
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-45c92e9c-4d31-5e96-8bd7-3d532734e117","_docIDNew":"bae-3ca9a4c3-6240-5e86-a00f-9590d2f2ecf3","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"}]}`,
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-8c8be5c6-d26b-50d4-9378-2acd5fe6959d","_docIDNew":"bae-c94e52f8-6e91-522c-b6a6-38346a06b3d2","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"}]}`,
},
},
}
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestBackupExport_AllCollectionsMultipleDocsAndMultipleDocUpdate_NoError(t *
Doc: `{"age": 31}`,
},
testUtils.BackupExport{
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-45c92e9c-4d31-5e96-8bd7-3d532734e117","_docIDNew":"bae-3ca9a4c3-6240-5e86-a00f-9590d2f2ecf3","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"},{"_docID":"bae-8fc3d148-869b-5629-ae22-5423c73f709b","_docIDNew":"bae-33c136bd-4375-54a0-81ff-54ca560c7bb8","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"Game of chains"}]}`,
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-4a28c746-ccbf-5511-91a9-391036f42f80","_docIDNew":"bae-d821f684-47de-5b63-b9c7-6eccec368e52","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"Game of chains"},{"_docID":"bae-8c8be5c6-d26b-50d4-9378-2acd5fe6959d","_docIDNew":"bae-c94e52f8-6e91-522c-b6a6-38346a06b3d2","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"}]}`,
},
},
}
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/backup/one_to_many/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr
ImportContent: `{
"Book":[
{
"_docID":"bae-8fc3d148-869b-5629-ae22-5423c73f709b",
"_docIDNew":"bae-33c136bd-4375-54a0-81ff-54ca560c7bb8",
"_docID":"bae-4a28c746-ccbf-5511-91a9-391036f42f80",
"_docIDNew":"bae-d821f684-47de-5b63-b9c7-6eccec368e52",
"author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f",
"name":"Game of chains"
},
{
"_docID":"bae-45c92e9c-4d31-5e96-8bd7-3d532734e117",
"_docIDNew":"bae-3ca9a4c3-6240-5e86-a00f-9590d2f2ecf3",
"_docID":"bae-8c8be5c6-d26b-50d4-9378-2acd5fe6959d",
"_docIDNew":"bae-c94e52f8-6e91-522c-b6a6-38346a06b3d2",
"author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f",
"name":"John and the sourcerers' stone"
}
Expand Down Expand Up @@ -150,13 +150,13 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr
Results: map[string]any{
"Book": []map[string]any{
{
"name": "Game of chains",
"name": "John and the sourcerers' stone",
"author": map[string]any{
"_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f",
},
},
{
"name": "John and the sourcerers' stone",
"name": "Game of chains",
"author": map[string]any{
"_docID": "bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f",
},
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/backup/one_to_one/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestBackupExport_AllCollectionsMultipleDocsAndDocUpdate_NoError(t *testing.
Doc: `{"age": 31}`,
},
testUtils.BackupExport{
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-f33a7110-fb6f-57aa-9501-df0111427315","_docIDNew":"bae-c9c1a385-afce-5ef7-8b98-9369b157fd97","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"}]}`,
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-af59fdc4-e495-5fd3-a9a6-386249aafdbb","_docIDNew":"bae-d374c406-c6ea-51cd-9e9b-dd44a97b499c","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"}]}`,
},
},
}
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestBackupExport_DoubleReletionship_NoError(t *testing.T) {
Doc: `{"age": 31}`,
},
testUtils.BackupExport{
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-ccf9da82-8ed6-5133-b64f-558c21bc8dfd","_docIDNew":"bae-27ae099a-fa7d-5a66-a919-6c3b0322d17c","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","name":"John and the sourcerers' stone"}]}`,
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-bddb7139-7035-5fff-a118-3fc2033723b3","_docIDNew":"bae-6972e51f-a8cd-59eb-9a34-8a37058ddf4e","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","name":"John and the sourcerers' stone"}]}`,
},
},
}
Expand Down Expand Up @@ -160,7 +160,7 @@ func TestBackupExport_DoubleReletionshipWithUpdate_NoError(t *testing.T) {
Doc: `{"age": 31}`,
},
testUtils.BackupExport{
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-ccf9da82-8ed6-5133-b64f-558c21bc8dfd","_docIDNew":"bae-27ae099a-fa7d-5a66-a919-6c3b0322d17c","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","name":"John and the sourcerers' stone"},{"_docID":"bae-ffba7007-d4d4-5630-be53-d66f56da57fd","_docIDNew":"bae-ffba7007-d4d4-5630-be53-d66f56da57fd","name":"Game of chains"}]}`,
ExpectedContent: `{"User":[{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"},{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"}],"Book":[{"_docID":"bae-0aa10275-4f6e-5b38-9915-5664dd4c7802","_docIDNew":"bae-0aa10275-4f6e-5b38-9915-5664dd4c7802","name":"Game of chains"},{"_docID":"bae-bddb7139-7035-5fff-a118-3fc2033723b3","_docIDNew":"bae-6972e51f-a8cd-59eb-9a34-8a37058ddf4e","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","name":"John and the sourcerers' stone"}]}`,
},
},
}
Expand Down
22 changes: 11 additions & 11 deletions tests/integration/backup/one_to_one/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollections_NoError(t *testing
Results: map[string]any{
"Book": []map[string]any{
{
"name": "Game of chains",
"name": "John and the sourcerers' stone",
},
{
"name": "John and the sourcerers' stone",
"name": "Game of chains",
},
},
},
Expand All @@ -88,8 +88,8 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndUpdatedDocs_NoEr
ImportContent: `{
"Book":[
{
"_docID":"bae-f33a7110-fb6f-57aa-9501-df0111427315",
"_docIDNew":"bae-c9c1a385-afce-5ef7-8b98-9369b157fd97",
"_docID":"bae-af59fdc4-e495-5fd3-a9a6-386249aafdbb",
"_docIDNew":"bae-d374c406-c6ea-51cd-9e9b-dd44a97b499c",
"author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f",
"name":"John and the sourcerers' stone"
}
Expand Down Expand Up @@ -171,8 +171,8 @@ func TestBackupImport_WithMultipleNoKeyAndMultipleCollectionsAndMultipleUpdatedD
"name":"Game of chains"
},
{
"_docID":"bae-f33a7110-fb6f-57aa-9501-df0111427315",
"_docIDNew":"bae-c9c1a385-afce-5ef7-8b98-9369b157fd97",
"_docID":"bae-af59fdc4-e495-5fd3-a9a6-386249aafdbb",
"_docIDNew":"bae-d374c406-c6ea-51cd-9e9b-dd44a97b499c",
"author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f",
"name":"John and the sourcerers' stone"
}
Expand Down Expand Up @@ -219,7 +219,7 @@ func TestBackupImport_DoubleRelationshipWithUpdate_NoError(t *testing.T) {
`,
},
testUtils.BackupImport{
ImportContent: `{"Book":[{"_docID":"bae-236c14bd-4621-5d43-bc03-4442f3b8719e","_docIDNew":"bae-6dbb3738-d3db-5121-acee-6fbdd97ff7a8","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"},{"_docID":"bae-ffba7007-d4d4-5630-be53-d66f56da57fd","_docIDNew":"bae-ffba7007-d4d4-5630-be53-d66f56da57fd","name":"Game of chains"}],"User":[{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"},{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"}]}`,
ImportContent: `{"Book":[{"_docID":"bae-236c14bd-4621-5d43-bc03-4442f3b8719e","_docIDNew":"bae-6dbb3738-d3db-5121-acee-6fbdd97ff7a8","author_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","favourite_id":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","name":"John and the sourcerers' stone"},{"_docID":"bae-0aa10275-4f6e-5b38-9915-5664dd4c7802","_docIDNew":"bae-0aa10275-4f6e-5b38-9915-5664dd4c7802","name":"Game of chains"}],"User":[{"_docID":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","_docIDNew":"bae-ebfe11e2-045d-525d-9fb7-2abb961dc84f","age":31,"name":"Bob"},{"_docID":"bae-7fca96a2-5f01-5558-a81f-09b47587f26d","_docIDNew":"bae-9918e1ec-c62b-5de2-8fbf-c82795b8ac7f","age":31,"name":"John"}]}`,
},
testUtils.Request{
Request: `
Expand All @@ -236,6 +236,10 @@ func TestBackupImport_DoubleRelationshipWithUpdate_NoError(t *testing.T) {
}`,
Results: map[string]any{
"Book": []map[string]any{
{
"name": "Game of chains",
"author": nil,
},
{
"name": "John and the sourcerers' stone",
"author": map[string]any{
Expand All @@ -245,10 +249,6 @@ func TestBackupImport_DoubleRelationshipWithUpdate_NoError(t *testing.T) {
},
},
},
{
"name": "Game of chains",
"author": nil,
},
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/backup/self_reference/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func TestBackupExport_Simple_NoError(t *testing.T) {
},
testUtils.CreateDoc{
CollectionID: 0,
Doc: `{"name": "Bob", "age": 31, "boss": "bae-a2162ff0-3257-50f1-ba2f-39c299921220"}`,
Doc: `{"name": "Bob", "age": 31, "boss": "bae-8096e3d7-41ab-5afe-ad88-481150483db1"}`,
},
testUtils.BackupExport{
Config: client.BackupConfig{
Collections: []string{"User"},
},
ExpectedContent: `{"User":[{"_docID":"bae-a2162ff0-3257-50f1-ba2f-39c299921220","_docIDNew":"bae-a2162ff0-3257-50f1-ba2f-39c299921220","age":30,"name":"John"},{"_docID":"bae-f4def2b3-2fe8-5e3b-838e-b9d9f8aca102","_docIDNew":"bae-f4def2b3-2fe8-5e3b-838e-b9d9f8aca102","age":31,"boss_id":"bae-a2162ff0-3257-50f1-ba2f-39c299921220","name":"Bob"}]}`,
ExpectedContent: `{"User":[{"_docID":"bae-0dfbaf9f-3c58-5133-aa07-a9f25d792f4e","_docIDNew":"bae-0dfbaf9f-3c58-5133-aa07-a9f25d792f4e","age":31,"boss_id":"bae-8096e3d7-41ab-5afe-ad88-481150483db1","name":"Bob"},{"_docID":"bae-8096e3d7-41ab-5afe-ad88-481150483db1","_docIDNew":"bae-8096e3d7-41ab-5afe-ad88-481150483db1","age":30,"name":"John"}]}`,
},
},
}
Expand All @@ -49,15 +49,15 @@ func TestBackupExport_MultipleDocsAndDocUpdate_NoError(t *testing.T) {
},
testUtils.CreateDoc{
CollectionID: 0,
Doc: `{"name": "Bob", "age": 31, "boss": "bae-a2162ff0-3257-50f1-ba2f-39c299921220"}`,
Doc: `{"name": "Bob", "age": 31, "boss": "bae-8096e3d7-41ab-5afe-ad88-481150483db1"}`,
},
testUtils.UpdateDoc{
CollectionID: 0,
DocID: 0,
Doc: `{"age": 31}`,
},
testUtils.BackupExport{
ExpectedContent: `{"User":[{"_docID":"bae-a2162ff0-3257-50f1-ba2f-39c299921220","_docIDNew":"bae-99fbc678-167f-5325-bdf1-79fa76039125","age":31,"name":"John"},{"_docID":"bae-f4def2b3-2fe8-5e3b-838e-b9d9f8aca102","_docIDNew":"bae-98531af8-dda5-5993-b140-1495fa8f1576","age":31,"boss_id":"bae-99fbc678-167f-5325-bdf1-79fa76039125","name":"Bob"}]}`,
ExpectedContent: `{"User":[{"_docID":"bae-0dfbaf9f-3c58-5133-aa07-a9f25d792f4e","_docIDNew":"bae-f3c5fc81-300f-5dd7-aeb3-20dd15883930","age":31,"boss_id":"bae-e4423c73-b867-511b-a5f1-565bd87d9c53","name":"Bob"},{"_docID":"bae-8096e3d7-41ab-5afe-ad88-481150483db1","_docIDNew":"bae-e4423c73-b867-511b-a5f1-565bd87d9c53","age":31,"name":"John"}]}`,
},
},
}
Expand Down
47 changes: 22 additions & 25 deletions tests/integration/backup/self_reference/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ func TestBackupSelfRefImport_Simple_NoError(t *testing.T) {
ImportContent: `{
"User":[
{
"_docID":"bae-f4def2b3-2fe8-5e3b-838e-b9d9f8aca102",
"_docID":"bae-0dfbaf9f-3c58-5133-aa07-a9f25d792f4e",
"age":31,
"boss_id":"bae-a2162ff0-3257-50f1-ba2f-39c299921220",
"boss_id":"bae-8096e3d7-41ab-5afe-ad88-481150483db1",
"name":"Bob"
},
{
"_docID":"bae-a2162ff0-3257-50f1-ba2f-39c299921220",
"_docID":"bae-8096e3d7-41ab-5afe-ad88-481150483db1",
"age":30,
"name":"John"
}
Expand All @@ -50,16 +50,16 @@ func TestBackupSelfRefImport_Simple_NoError(t *testing.T) {
}`,
Results: map[string]any{
"User": []map[string]any{
{
"name": "John",
"boss": nil,
},
{
"name": "Bob",
"boss": map[string]any{
"name": "John",
},
},
{
"name": "John",
"boss": nil,
},
},
},
},
Expand All @@ -73,10 +73,10 @@ func TestBackupSelfRefImport_SelfRef_NoError(t *testing.T) {
expectedExportData := `{` +
`"User":[` +
`{` +
`"_docID":"bae-20631b3d-1498-51f1-be29-5c0effbfa646",` +
`"_docIDNew":"bae-20631b3d-1498-51f1-be29-5c0effbfa646",` +
`"_docID":"bae-b9449db8-3894-5701-84ce-ee96a3eafc9c",` +
`"_docIDNew":"bae-b9449db8-3894-5701-84ce-ee96a3eafc9c",` +
`"age":31,` +
`"boss_id":"bae-20631b3d-1498-51f1-be29-5c0effbfa646",` +
`"boss_id":"bae-b9449db8-3894-5701-84ce-ee96a3eafc9c",` +
`"name":"Bob"` +
`}` +
`]` +
Expand All @@ -100,7 +100,7 @@ func TestBackupSelfRefImport_SelfRef_NoError(t *testing.T) {
testUtils.UpdateDoc{
NodeID: immutable.Some(0),
Doc: `{
"boss_id": "bae-20631b3d-1498-51f1-be29-5c0effbfa646"
"boss_id": "bae-b9449db8-3894-5701-84ce-ee96a3eafc9c"
}`,
},
testUtils.BackupExport{
Expand Down Expand Up @@ -277,18 +277,18 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t
expectedExportData := `{` +
`"Author":[` +
`{` +
`"_docID":"bae-069af8c0-9728-5dde-84ff-ab2dd836f165",` +
`"_docIDNew":"bae-f2e84aeb-decc-5e40-94ff-e365f0ed0f4b",` +
`"book_id":"bae-006376a9-5ceb-5bd0-bfed-6ff5afd3eb93",` +
`"_docID":"bae-bf1f16db-3c02-5759-8127-7d73346442cc",` +
`"_docIDNew":"bae-bf1f16db-3c02-5759-8127-7d73346442cc",` +
`"book_id":"bae-89136f56-3779-5656-b8a6-f76a1c262f37",` +
`"name":"John"` +
`}` +
`],` +
`"Book":[` +
`{` +
`"_docID":"bae-2b931633-22bf-576f-b788-d8098b213e5a",` +
`"_docIDNew":"bae-c821a0a9-7afc-583b-accb-dc99a09c1ff8",` +
`"_docID":"bae-89136f56-3779-5656-b8a6-f76a1c262f37",` +
`"_docIDNew":"bae-66b0f769-c743-5a50-ae6d-1dcd978e2404",` +
`"name":"John and the sourcerers' stone",` +
`"reviewedBy_id":"bae-069af8c0-9728-5dde-84ff-ab2dd836f165"` +
`"reviewedBy_id":"bae-bf1f16db-3c02-5759-8127-7d73346442cc"` +
`}` +
`]` +
`}`
Expand Down Expand Up @@ -316,7 +316,7 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t
testUtils.CreateDoc{
NodeID: immutable.Some(0),
CollectionID: 1,
// bae-2b931633-22bf-576f-b788-d8098b213e5a
// bae-89136f56-3779-5656-b8a6-f76a1c262f37
Doc: `{
"name": "John and the sourcerers' stone"
}`,
Expand All @@ -326,15 +326,15 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t
CollectionID: 0,
Doc: `{
"name": "John",
"book": "bae-2b931633-22bf-576f-b788-d8098b213e5a"
"book": "bae-89136f56-3779-5656-b8a6-f76a1c262f37"
}`,
},
testUtils.UpdateDoc{
NodeID: immutable.Some(0),
CollectionID: 1,
DocID: 0,
Doc: `{
"reviewedBy_id": "bae-069af8c0-9728-5dde-84ff-ab2dd836f165"
"reviewedBy_id": "bae-bf1f16db-3c02-5759-8127-7d73346442cc"
}`,
},
/*
Expand Down Expand Up @@ -366,11 +366,8 @@ func TestBackupSelfRefImport_SplitPrimaryRelationWithSecondCollection_NoError(t
Results: map[string]any{
"Book": []map[string]any{
{
"name": "John and the sourcerers' stone",
"author": map[string]any{
"name": "John",
"reviewed": nil,
},
"name": "John and the sourcerers' stone",
"author": nil,
},
},
},
Expand Down
Loading

0 comments on commit 7b33009

Please sign in to comment.