Skip to content

Commit

Permalink
test: transactions query test
Browse files Browse the repository at this point in the history
  • Loading branch information
thevaibhav-dixit committed Aug 17, 2024
1 parent 848fdcd commit 5853bb1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bats/e2e.bats
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,20 @@ teardown_file() {
exec_graphql 'account-with-balance' "$variables"
balance=$(graphql_output '.data.account.balance.settled.normalBalance.units')
[[ $balance == "9.53" ]] || exit 1

# list transactions
exec_graphql 'transactions' '{}'
first_ts=$(graphql_output '.data.transactions.nodes[1].createdAt')

variables=$(jq -n \
--arg end_cursor "$end_cursor" \
'{
"after": $end_cursor
}'
)

exec_graphql 'transactions' "$variables"
second_ts=$(graphql_output '.data.transactions.nodes[0].createdAt')

[[ $(date -d "$second_ts" +%s) -lt $(date -d "$first_ts" +%s) ]] || exit 1
}
12 changes: 12 additions & 0 deletions bats/gql/transactions.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
query Transaction($after: String) {
transactions(first: 2, after: $after) {
nodes {
transactionId
createdAt
}
pageInfo {
hasNextPage
endCursor
}
}
}

0 comments on commit 5853bb1

Please sign in to comment.