Skip to content

Commit

Permalink
refactor(iota-graphql-e2e-test): update comments and add more info in…
Browse files Browse the repository at this point in the history
… object/pagination
  • Loading branch information
kodemartin committed Oct 17, 2024
1 parent 1c6eb83 commit fef4fb0
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 20 deletions.
94 changes: 79 additions & 15 deletions crates/iota-graphql-e2e-tests/tests/objects/pagination.exp
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
processed 14 tasks
processed 15 tasks

task 1, lines 7-20:
//# publish
created: object(1,0)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 5175600, storage_rebate: 0, non_refundable_storage_fee: 0

task 2, line 22:
task 2, lines 22-23:
//# run Test::M1::create --args 0 @A
created: object(2,0)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 988000, non_refundable_storage_fee: 0

task 3, line 24:
task 3, lines 25-26:
//# run Test::M1::create --args 1 @A
created: object(3,0)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 988000, non_refundable_storage_fee: 0

task 4, line 26:
task 4, lines 28-29:
//# run Test::M1::create --args 2 @A
created: object(4,0)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 988000, non_refundable_storage_fee: 0

task 5, line 28:
task 5, lines 31-32:
//# run Test::M1::create --args 3 @A
created: object(5,0)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 988000, non_refundable_storage_fee: 0

task 6, line 30:
task 6, lines 34-35:
//# run Test::M1::create --args 4 @A
created: object(6,0)
mutated: object(0,0)
gas summary: computation_cost: 1000000, storage_cost: 2302800, storage_rebate: 988000, non_refundable_storage_fee: 0

task 7, line 32:
task 7, line 37:
//# create-checkpoint
Checkpoint created: 1

task 8, lines 35-45:
task 8, lines 39-49:
//# run-graphql
Response: {
"data": {
Expand Down Expand Up @@ -68,7 +68,7 @@ Response: {
}
}

task 9, lines 47-57:
task 9, lines 51-61:
//# run-graphql
Response: {
"data": {
Expand All @@ -87,7 +87,65 @@ Response: {
}
}

task 10, lines 59-71:
task 10, lines 63-92:
//# run-graphql
Response: {
"data": {
"address": {
"objects": {
"edges": [
{
"cursor": "IARuBxQGdlm/x5t9Q82cgrIxPTBO9GBqvkbDKhYIhz7YAQAAAAAAAAA=",
"node": {
"address": "0x046e0714067659bfc79b7d43cd9c82b2313d304ef4606abe46c32a1608873ed8"
}
},
{
"cursor": "IB6e5J4edKc2MhwlGvmoMTWjQ4+HGr8W5MWcY9kfv64xAQAAAAAAAAA=",
"node": {
"address": "0x1e9ee49e1e74a736321c251af9a83135a3438f871abf16e4c59c63d91fbfae31"
}
},
{
"cursor": "IE0gJHC7t6A+bUjioMnjvtBAtGuOVTGTHi5Gt6ZitVETAQAAAAAAAAA=",
"node": {
"address": "0x4d202470bbb7a03e6d48e2a0c9e3bed040b46b8e5531931e2e46b7a662b55113"
}
},
{
"cursor": "IG+EZXhz/oR1Mgyv/IT/0dqptKQmZTv5cM62IxAx/+3vAQAAAAAAAAA=",
"node": {
"address": "0x6f84657873fe8475320caffc84ffd1daa9b4a426653bf970ceb6231031ffedef"
}
},
{
"cursor": "ILkx4mJnMmXPTihsLidYvTK3i183vDH+Y7XMfMlwamSVAQAAAAAAAAA=",
"node": {
"address": "0xb931e262673265cf4e286c2e2758bd32b78b5f37bc31fe63b5cc7cc9706a6495"
}
}
]
}
},
"obj_3_0": {
"address": "0x046e0714067659bfc79b7d43cd9c82b2313d304ef4606abe46c32a1608873ed8"
},
"obj_5_0": {
"address": "0x1e9ee49e1e74a736321c251af9a83135a3438f871abf16e4c59c63d91fbfae31"
},
"obj_6_0": {
"address": "0x4d202470bbb7a03e6d48e2a0c9e3bed040b46b8e5531931e2e46b7a662b55113"
},
"obj_4_0": {
"address": "0x6f84657873fe8475320caffc84ffd1daa9b4a426653bf970ceb6231031ffedef"
},
"obj_2_0": {
"address": "0xb931e262673265cf4e286c2e2758bd32b78b5f37bc31fe63b5cc7cc9706a6495"
}
}
}

task 11, lines 94-106:
//# run-graphql --cursors @{obj_5_0}
Response: {
"data": {
Expand All @@ -106,7 +164,7 @@ Response: {
}
}

task 11, lines 73-83:
task 12, lines 108-118:
//# run-graphql --cursors @{obj_4_0}
Response: {
"data": {
Expand All @@ -122,7 +180,7 @@ Response: {
}
}

task 12, lines 85-95:
task 13, lines 120-130:
//# run-graphql --cursors @{obj_3_0}
Response: {
"data": {
Expand All @@ -134,18 +192,24 @@ Response: {
}
}

task 13, lines 97-106:
task 14, lines 132-144:
//# run-graphql
Response: {
"data": {
"address": {
"objects": {
"edges": [
{
"cursor": "IG+EZXhz/oR1Mgyv/IT/0dqptKQmZTv5cM62IxAx/+3vAQAAAAAAAAA="
"cursor": "IG+EZXhz/oR1Mgyv/IT/0dqptKQmZTv5cM62IxAx/+3vAQAAAAAAAAA=",
"node": {
"address": "0x6f84657873fe8475320caffc84ffd1daa9b4a426653bf970ceb6231031ffedef"
}
},
{
"cursor": "ILkx4mJnMmXPTihsLidYvTK3i183vDH+Y7XMfMlwamSVAQAAAAAAAAA="
"cursor": "ILkx4mJnMmXPTihsLidYvTK3i183vDH+Y7XMfMlwamSVAQAAAAAAAAA=",
"node": {
"address": "0xb931e262673265cf4e286c2e2758bd32b78b5f37bc31fe63b5cc7cc9706a6495"
}
}
]
}
Expand Down
48 changes: 43 additions & 5 deletions crates/iota-graphql-e2e-tests/tests/objects/pagination.move
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ module Test::M1 {
}

//# run Test::M1::create --args 0 @A
# create obj_2_0 (1st object) for A

//# run Test::M1::create --args 1 @A
# create obj_3_0 (2nd object) for A

//# run Test::M1::create --args 2 @A
# create obj_4_0 (3rd object) for A

//# run Test::M1::create --args 3 @A
# create obj_5_0 (4th object) for A

//# run Test::M1::create --args 4 @A
# create obj_6_0 (5th object) for A

//# create-checkpoint


//# run-graphql
{
# select all objects owned by A
Expand All @@ -56,10 +60,41 @@ module Test::M1 {
}
}

//# run-graphql
{
# show the order of all object owned by A
# order is defined by the bytes of their address
address(address: "@{A}") {
objects {
edges {
cursor
node {
address
}
}
}
}
obj_3_0: object(address: "@{obj_3_0}") {
address
}
obj_5_0: object(address: "@{obj_5_0}") {
address
}
obj_6_0: object(address: "@{obj_6_0}") {
address
}
obj_4_0: object(address: "@{obj_4_0}") {
address
}
obj_2_0: object(address: "@{obj_2_0}") {
address
}
}

//# run-graphql --cursors @{obj_5_0}
{
address(address: "@{A}") {
# select the 2nd and 3rd objects
# select the 5th and 3rd objects
# note that order does not correspond
# to order in which objects were created
objects(first: 2 after: "@{cursor_0}") {
Expand All @@ -73,8 +108,8 @@ module Test::M1 {
//# run-graphql --cursors @{obj_4_0}
{
address(address: "@{A}") {
# select 4th and last object
objects(first: 2 after: "@{cursor_0}") {
# select 1st object
objects(first: 1 after: "@{cursor_0}") {
edges {
cursor
}
Expand All @@ -85,7 +120,7 @@ module Test::M1 {
//# run-graphql --cursors @{obj_3_0}
{
address(address: "@{A}") {
# select 3rd and 4th object
# select no object
objects(last: 2 before: "@{cursor_0}") {
edges {
cursor
Expand All @@ -100,6 +135,9 @@ module Test::M1 {
objects(last: 2) {
edges {
cursor
node {
address
}
}
}
}
Expand Down

0 comments on commit fef4fb0

Please sign in to comment.