Skip to content

Commit

Permalink
[test-adapter] refactor query interpolation and change format for bcs…
Browse files Browse the repository at this point in the history
… cursors
  • Loading branch information
emmazzz committed Feb 9, 2025
1 parent 3ee9343 commit 3dfced4
Show file tree
Hide file tree
Showing 21 changed files with 171 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ module P0::fake {
}
}

//# run-graphql --cursors @{obj_1_1,2}
//# run-graphql --cursors bcs:(@{obj_1_1},2)
# There should be two coins, and the coin owners should be the same as the owner of the first coin in the previous query
{
availableRange {
Expand Down Expand Up @@ -162,7 +162,7 @@ module P0::fake {
}
}

//# run-graphql --cursors @{obj_1_1,1}
//# run-graphql --cursors bcs:(@{obj_1_1},1)
# Outside of available range
{
availableRange {
Expand Down Expand Up @@ -190,7 +190,7 @@ module P0::fake {
}
}

//# run-graphql --cursors @{obj_1_1,0}
//# run-graphql --cursors bcs:(@{obj_1_1},0)
# Outside of available range
{
availableRange {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Response: {
}

task 12, lines 137-163:
//# run-graphql --cursors @{obj_1_1,2}
//# run-graphql --cursors bcs:(@{obj_1_1},2)
Response: {
"data": {
"availableRange": {
Expand Down Expand Up @@ -293,7 +293,7 @@ Response: {
}

task 13, lines 165-191:
//# run-graphql --cursors @{obj_1_1,1}
//# run-graphql --cursors bcs:(@{obj_1_1},1)
Response: {
"data": null,
"errors": [
Expand All @@ -316,7 +316,7 @@ Response: {
}

task 14, lines 193-219:
//# run-graphql --cursors @{obj_1_1,0}
//# run-graphql --cursors bcs:(@{obj_1_1},0)
Response: {
"data": null,
"errors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ fragment DynamicFieldsSelect on DynamicFieldConnection {

//# create-checkpoint

//# run-graphql --cursors @{obj_5_0,1} @{obj_5_0,2}
//# run-graphql --cursors bcs:(@{obj_5_0},1) bcs:(@{obj_5_0},2)
fragment DynamicFieldSelect on DynamicField {
name {
bcs
Expand Down Expand Up @@ -284,7 +284,7 @@ fragment DynamicFieldSelect on DynamicField {

//# create-checkpoint

//# run-graphql --cursors @{obj_5_0,2} @{obj_5_0,3}
//# run-graphql --cursors bcs:(@{obj_5_0},2) bcs:(@{obj_5_0},3)
fragment DynamicFieldSelect on DynamicField {
name {
bcs
Expand Down Expand Up @@ -345,7 +345,7 @@ fragment DynamicFieldsSelect on DynamicFieldConnection {

//# create-checkpoint

//# run-graphql --cursors @{obj_5_0,2} @{obj_5_0,4}
//# run-graphql --cursors bcs:(@{obj_5_0},2) bcs:(@{obj_5_0},4)
fragment DynamicFieldSelect on DynamicField {
name {
bcs
Expand Down Expand Up @@ -446,7 +446,7 @@ fragment DynamicFieldSelect on DynamicField {

//# create-checkpoint

//# run-graphql --cursors @{obj_5_0,2} @{obj_5_0,4}
//# run-graphql --cursors bcs:(@{obj_5_0},2) bcs:(@{obj_5_0},4)
fragment DynamicFieldSelect on DynamicField {
name {
bcs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ task 13, line 174:
Checkpoint created: 2

task 14, lines 176-236:
//# run-graphql --cursors @{obj_5_0,1} @{obj_5_0,2}
//# run-graphql --cursors bcs:(@{obj_5_0},1) bcs:(@{obj_5_0},2)
Response: {
"data": {
"parent_version_4_show_dof_and_dfs": {
Expand Down Expand Up @@ -408,7 +408,7 @@ task 19, line 285:
Checkpoint created: 3

task 20, lines 287-337:
//# run-graphql --cursors @{obj_5_0,2} @{obj_5_0,3}
//# run-graphql --cursors bcs:(@{obj_5_0},2) bcs:(@{obj_5_0},3)
Response: {
"data": {
"parent_version_4_has_4_children": {
Expand Down Expand Up @@ -737,7 +737,7 @@ task 24, line 346:
Checkpoint created: 4

task 25, lines 348-398:
//# run-graphql --cursors @{obj_5_0,2} @{obj_5_0,4}
//# run-graphql --cursors bcs:(@{obj_5_0},2) bcs:(@{obj_5_0},4)
Response: {
"data": {
"parent_version_4_has_df1_2_3": {
Expand Down Expand Up @@ -999,7 +999,7 @@ task 34, line 447:
Checkpoint created: 8

task 35, lines 449-507:
//# run-graphql --cursors @{obj_5_0,2} @{obj_5_0,4}
//# run-graphql --cursors bcs:(@{obj_5_0},2) bcs:(@{obj_5_0},4)
Response: {
"data": {
"availableRange": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ module Test::M1 {
}
}

//# run-graphql --cursors @{obj_1_0,6}
//# run-graphql --cursors bcs:(@{obj_1_0},6)
# But it would no longer be possible to try to paginate using a cursor that falls outside the available range
{
availableRange {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Response: {
}

task 32, lines 292-312:
//# run-graphql --cursors @{obj_1_0,6}
//# run-graphql --cursors bcs:(@{obj_1_0},6)
Response: {
"data": null,
"errors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module Test::M1 {

//# create-checkpoint

//# run-graphql --cursors @{obj_2_0} @{obj_3_0}
//# run-graphql --cursors bcs_obj:@{obj_2_0} bcs_obj:@{obj_3_0}
{
one_of_these_will_yield_an_object: address(address: "@{A}") {
objects(filter: {type: "@{Test}"}, after: "@{cursor_0}") {
Expand Down Expand Up @@ -69,7 +69,7 @@ module Test::M1 {

//# create-checkpoint

//# run-graphql --cursors @{obj_2_0,1} @{obj_3_0,1}
//# run-graphql --cursors bcs:(@{obj_2_0},1) bcs:(@{obj_3_0},1)
{
paginating_on_checkpoint_1: address(address: "@{A}") {
objects(filter: {type: "@{Test}"}, after: "@{cursor_0}") {
Expand Down Expand Up @@ -148,7 +148,7 @@ module Test::M1 {

//# create-checkpoint

//# run-graphql --cursors @{obj_6_0,2}
//# run-graphql --cursors bcs:(@{obj_6_0},2)
{
after_obj_6_0_at_checkpoint_2: address(address: "@{A}") {
objects(filter: {type: "@{Test}"}, after: "@{cursor_0}") {
Expand Down Expand Up @@ -228,7 +228,7 @@ module Test::M1 {

//# create-checkpoint

//# run-graphql --cursors @{obj_6_0,2}
//# run-graphql --cursors bcs:(@{obj_6_0},2)
# This query will error due to requesting data outside of available range
{
availableRange {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ task 4, line 34:
Checkpoint created: 1

task 5, lines 36-64:
//# run-graphql --cursors @{obj_2_0} @{obj_3_0}
//# run-graphql --cursors bcs_obj:@{obj_2_0} bcs_obj:@{obj_3_0}
Response: {
"data": {
"one_of_these_will_yield_an_object": {
Expand Down Expand Up @@ -75,7 +75,7 @@ task 8, line 70:
Checkpoint created: 2

task 9, lines 72-100:
//# run-graphql --cursors @{obj_2_0,1} @{obj_3_0,1}
//# run-graphql --cursors bcs:(@{obj_2_0},1) bcs:(@{obj_3_0},1)
Response: {
"data": {
"paginating_on_checkpoint_1": {
Expand Down Expand Up @@ -237,7 +237,7 @@ task 13, line 149:
Checkpoint created: 3

task 14, lines 151-213:
//# run-graphql --cursors @{obj_6_0,2}
//# run-graphql --cursors bcs:(@{obj_6_0},2)
Response: {
"data": {
"after_obj_6_0_at_checkpoint_2": {
Expand Down Expand Up @@ -521,7 +521,7 @@ task 22, line 229:
Checkpoint created: 7

task 23, lines 231-255:
//# run-graphql --cursors @{obj_6_0,2}
//# run-graphql --cursors bcs:(@{obj_6_0},2)
Response: {
"data": null,
"errors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module Test::M1 {

//# create-checkpoint

//# run-graphql --cursors @{obj_3_0}
//# run-graphql --cursors bcs_obj:@{obj_3_0}
{
after_obj_3_0: address(address: "@{A}") {
objects(filter: {type: "@{Test}"}, after: "@{cursor_0}") {
Expand Down Expand Up @@ -68,7 +68,7 @@ module Test::M1 {

//# create-checkpoint

//# run-graphql --cursors @{obj_3_0,1}
//# run-graphql --cursors bcs:(@{obj_3_0},1)
# This query should yield the same results as the previous one.
{
after_obj_3_0_chkpt_1: address(address: "@{A}") {
Expand Down Expand Up @@ -99,7 +99,7 @@ module Test::M1 {
}
}

//# run-graphql --cursors @{obj_3_0,2}
//# run-graphql --cursors bcs:(@{obj_3_0},2)
{
address(address: "@{A}") {
objects(filter: {type: "@{Test}"}) {
Expand Down Expand Up @@ -180,7 +180,7 @@ module Test::M1 {

//# create-checkpoint

//# run-graphql --cursors @{obj_3_0,2}
//# run-graphql --cursors bcs:(@{obj_3_0},2)
# This query should yield the same results as the previous one.
{
after_obj_3_0_chkpt_2: address(address: "@{A}") {
Expand Down Expand Up @@ -245,7 +245,7 @@ module Test::M1 {
}
}

//# run-graphql --cursors @{obj_3_0,3}
//# run-graphql --cursors bcs:(@{obj_3_0},3)
{
address(address: "@{A}") {
objects(filter: {type: "@{Test}"}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ task 5, line 35:
Checkpoint created: 1

task 6, lines 37-65:
//# run-graphql --cursors @{obj_3_0}
//# run-graphql --cursors bcs_obj:@{obj_3_0}
Response: {
"data": {
"after_obj_3_0": {
Expand Down Expand Up @@ -73,7 +73,7 @@ task 8, line 69:
Checkpoint created: 2

task 9, lines 71-100:
//# run-graphql --cursors @{obj_3_0,1}
//# run-graphql --cursors bcs:(@{obj_3_0},1)
Response: {
"data": {
"after_obj_3_0_chkpt_1": {
Expand Down Expand Up @@ -103,7 +103,7 @@ Response: {
}

task 10, lines 102-177:
//# run-graphql --cursors @{obj_3_0,2}
//# run-graphql --cursors bcs:(@{obj_3_0},2)
Response: {
"data": {
"address": {
Expand Down Expand Up @@ -204,7 +204,7 @@ task 12, line 181:
Checkpoint created: 3

task 13, lines 183-246:
//# run-graphql --cursors @{obj_3_0,2}
//# run-graphql --cursors bcs:(@{obj_3_0},2)
Response: {
"data": {
"after_obj_3_0_chkpt_2": {
Expand Down Expand Up @@ -266,7 +266,7 @@ Response: {
}

task 14, lines 248-323:
//# run-graphql --cursors @{obj_3_0,3}
//# run-graphql --cursors bcs:(@{obj_3_0},3)
Response: {
"data": {
"address": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}
}

//# run-graphql --cursors @{obj_3_1,1} @{obj_7_0,1}
//# run-graphql --cursors bcs:(@{obj_3_1},1) bcs:(@{obj_7_0},1)
# Even though there is a stake created after the initial one, the cursor locks the upper bound to
# checkpoint 1 - at that point in time, we did not have any additional stakes.
{
Expand Down Expand Up @@ -101,7 +101,7 @@
}
}

//# run-graphql --cursors @{obj_3_1,3} @{obj_7_0,3}
//# run-graphql --cursors bcs:(@{obj_3_1},3) bcs:(@{obj_7_0},3)
# The second stake was created at checkpoint 3, and thus will be visible.
{
coins_after_obj_3_1_chkpt_3: address(address: "@{C}") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Response: {
}

task 13, lines 58-102:
//# run-graphql --cursors @{obj_3_1,1} @{obj_7_0,1}
//# run-graphql --cursors bcs:(@{obj_3_1},1) bcs:(@{obj_7_0},1)
Response: {
"data": {
"no_coins_after_obj_3_1_chkpt_1": {
Expand All @@ -157,7 +157,7 @@ Response: {
}

task 14, lines 104-147:
//# run-graphql --cursors @{obj_3_1,3} @{obj_7_0,3}
//# run-graphql --cursors bcs:(@{obj_3_1},3) bcs:(@{obj_7_0},3)
Response: {
"data": {
"coins_after_obj_3_1_chkpt_3": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module Test::M1 {
}
}

//# run-graphql --cursors @{obj_5_0}
//# run-graphql --cursors bcs_obj:@{obj_5_0}
{
address(address: "@{A}") {
# select the 2nd and 3rd objects
Expand All @@ -68,7 +68,7 @@ module Test::M1 {
}
}

//# run-graphql --cursors @{obj_4_0}
//# run-graphql --cursors bcs_obj:@{obj_4_0}
{
address(address: "@{A}") {
# select 4th and last object
Expand All @@ -80,7 +80,7 @@ module Test::M1 {
}
}

//# run-graphql --cursors @{obj_3_0}
//# run-graphql --cursors bcs_obj:@{obj_3_0}
{
address(address: "@{A}") {
# select 3rd and 4th object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Response: {
}

task 10, lines 57-69:
//# run-graphql --cursors @{obj_5_0}
//# run-graphql --cursors bcs_obj:@{obj_5_0}
Response: {
"data": {
"address": {
Expand All @@ -103,7 +103,7 @@ Response: {
}

task 11, lines 71-81:
//# run-graphql --cursors @{obj_4_0}
//# run-graphql --cursors bcs_obj:@{obj_4_0}
Response: {
"data": {
"address": {
Expand All @@ -122,7 +122,7 @@ Response: {
}

task 12, lines 83-93:
//# run-graphql --cursors @{obj_3_0}
//# run-graphql --cursors bcs_obj:@{obj_3_0}
Response: {
"data": {
"address": {
Expand Down
Loading

0 comments on commit 3dfced4

Please sign in to comment.