Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
test(graphql-server): queries with variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gligneul committed Sep 10, 2023
1 parent 48d1cda commit 1a0fa93
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions offchain/graphql-server/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,18 @@ async fn query_reports() {
test.server.stop().await;
}

#[actix_web::test]
#[serial_test::serial]
async fn query_with_variables() {
let docker = Cli::default();
let test = TestState::setup(&docker).await;
test.populate_database().await;

let body = post_query_request("variables.json").await;
assert_from_body(body, "variables.json");
test.server.stop().await;
}

#[actix_web::test]
#[serial_test::serial]
async fn query_input() {
Expand Down
6 changes: 6 additions & 0 deletions offchain/graphql-server/tests/queries/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"query": "query getInput($inputIndex: Int!) { input(index: $inputIndex) { blockNumber } }",
"variables": {
"inputIndex": 0
}
}
1 change: 1 addition & 0 deletions offchain/graphql-server/tests/responses/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data":{"input":{"blockNumber":"0"}}}

0 comments on commit 1a0fa93

Please sign in to comment.