From 47b9a0d4f6cdc2fe8f283da718869da3c62eccea Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Tue, 22 Oct 2024 15:07:38 -0400 Subject: [PATCH] WIP - Migrate tests to CidIndex --- .../integration/query/commits/simple_test.go | 26 +++++++++---------- .../query/commits/with_delete_test.go | 7 +++++ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/integration/query/commits/simple_test.go b/tests/integration/query/commits/simple_test.go index 6a69578ada..490eb03a89 100644 --- a/tests/integration/query/commits/simple_test.go +++ b/tests/integration/query/commits/simple_test.go @@ -37,13 +37,13 @@ func TestQueryCommits(t *testing.T) { Results: map[string]any{ "commits": []map[string]any{ { - "cid": "bafyreif6dqbkr7t37jcjfxxrjnxt7cspxzvs7qwlbtjca57cc663he4s7e", + "cid": testUtils.NewCidIndex(0, 0, "1", 0), }, { - "cid": "bafyreigtnj6ntulcilkmin4pgukjwv3nwglqpiiyddz3dyfexdbltze7sy", + "cid": testUtils.NewCidIndex(0, 0, "2", 0), }, { - "cid": "bafyreia2vlbfkcbyogdjzmbqcjneabwwwtw7ti2xbd7yor5mbu2sk4pcoy", + "cid": testUtils.NewCompCidIndex(0, 0, 0), }, }, }, @@ -364,7 +364,7 @@ func TestQuery_CommitsWithAllFieldsWithUpdate_NoError(t *testing.T) { Results: map[string]any{ "commits": []map[string]any{ { - "cid": "bafyreih5h6i6ohfsgrcjtg76iarebqcurpaft73gpobl2z2cfsvihsgdqu", + "cid": testUtils.NewCidIndex(0, 0, "1", 1), "collectionID": int64(1), "delta": testUtils.CBORValue(22), "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", @@ -373,13 +373,13 @@ func TestQuery_CommitsWithAllFieldsWithUpdate_NoError(t *testing.T) { "height": int64(2), "links": []map[string]any{ { - "cid": "bafyreif6dqbkr7t37jcjfxxrjnxt7cspxzvs7qwlbtjca57cc663he4s7e", + "cid": testUtils.NewCidIndex(0, 0, "1", 0), "name": "_head", }, }, }, { - "cid": "bafyreif6dqbkr7t37jcjfxxrjnxt7cspxzvs7qwlbtjca57cc663he4s7e", + "cid": testUtils.NewCidIndex(0, 0, "1", 0), "collectionID": int64(1), "delta": testUtils.CBORValue(21), "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", @@ -389,7 +389,7 @@ func TestQuery_CommitsWithAllFieldsWithUpdate_NoError(t *testing.T) { "links": []map[string]any{}, }, { - "cid": "bafyreigtnj6ntulcilkmin4pgukjwv3nwglqpiiyddz3dyfexdbltze7sy", + "cid": testUtils.NewCidIndex(0, 0, "2", 0), "collectionID": int64(1), "delta": testUtils.CBORValue("John"), "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", @@ -399,7 +399,7 @@ func TestQuery_CommitsWithAllFieldsWithUpdate_NoError(t *testing.T) { "links": []map[string]any{}, }, { - "cid": "bafyreiale6qsjc7qewod3c6h2odwamfwcf7vt4zlqtw7ldcm57xdkgxja4", + "cid": testUtils.NewCompCidIndex(0, 0, 1), "collectionID": int64(1), "delta": nil, "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", @@ -408,17 +408,17 @@ func TestQuery_CommitsWithAllFieldsWithUpdate_NoError(t *testing.T) { "height": int64(2), "links": []map[string]any{ { - "cid": "bafyreia2vlbfkcbyogdjzmbqcjneabwwwtw7ti2xbd7yor5mbu2sk4pcoy", + "cid": testUtils.NewCompCidIndex(0, 0, 0), "name": "_head", }, { - "cid": "bafyreih5h6i6ohfsgrcjtg76iarebqcurpaft73gpobl2z2cfsvihsgdqu", + "cid": testUtils.NewCidIndex(0, 0, "1", 1), "name": "age", }, }, }, { - "cid": "bafyreia2vlbfkcbyogdjzmbqcjneabwwwtw7ti2xbd7yor5mbu2sk4pcoy", + "cid": testUtils.NewCompCidIndex(0, 0, 0), "collectionID": int64(1), "delta": nil, "docID": "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", @@ -427,11 +427,11 @@ func TestQuery_CommitsWithAllFieldsWithUpdate_NoError(t *testing.T) { "height": int64(1), "links": []map[string]any{ { - "cid": "bafyreif6dqbkr7t37jcjfxxrjnxt7cspxzvs7qwlbtjca57cc663he4s7e", + "cid": testUtils.NewCidIndex(0, 0, "1", 0), "name": "age", }, { - "cid": "bafyreigtnj6ntulcilkmin4pgukjwv3nwglqpiiyddz3dyfexdbltze7sy", + "cid": testUtils.NewCidIndex(0, 0, "2", 0), "name": "name", }, }, diff --git a/tests/integration/query/commits/with_delete_test.go b/tests/integration/query/commits/with_delete_test.go index cd52f5d861..92b687b64b 100644 --- a/tests/integration/query/commits/with_delete_test.go +++ b/tests/integration/query/commits/with_delete_test.go @@ -40,8 +40,10 @@ func TestQueryCommits_AfterDocDeletion_ShouldStillFetch(t *testing.T) { Request: ` query { commits(fieldId: "C") { + cid fieldName links { + cid name } } @@ -50,20 +52,25 @@ func TestQueryCommits_AfterDocDeletion_ShouldStillFetch(t *testing.T) { Results: map[string]any{ "commits": []map[string]any{ { + "cid": testUtils.NewCompCidIndex(0, 0, 1), "fieldName": nil, "links": []map[string]any{ { + "cid": testUtils.NewCompCidIndex(0, 0, 0), "name": "_head", }, }, }, { + "cid": testUtils.NewCompCidIndex(0, 0, 0), "fieldName": nil, "links": []map[string]any{ { + "cid": testUtils.NewCidIndex(0, 0, "1", 0), "name": "age", }, { + "cid": testUtils.NewCidIndex(0, 0, "2", 0), "name": "name", }, },