Skip to content

Commit

Permalink
chore(thegraph-graphql-http): update test server URL (#478)
Browse files Browse the repository at this point in the history
* Revert "chore(thegraph-graphql-http): disable tests due to unavailable test dependency (II) (#464)"

This reverts commit 46671ae.

* Revert "chore(thegraph-graphql-http): disable tests due to unavailable test dependency (#462)"

This reverts commit 92b13d0.

* chore(thegraph-graphql-http): update test server URL

Signed-off-by: Lorenzo Delgado <[email protected]>

---------

Signed-off-by: Lorenzo Delgado <[email protected]>
  • Loading branch information
LNSD authored Jan 27, 2025
1 parent 32c8065 commit 0e44fd1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
14 changes: 3 additions & 11 deletions thegraph-graphql-http/tests/it_graphql_http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ use thegraph_graphql_http::{
///
/// This a GraphQL server that implements the [Star Wars API](https://swapi.dev/). See
/// https://github.com/graphql/swapi-graphql for more information.
const TEST_SERVER_URL: &str = "https://swapi-graphql.netlify.app/.netlify/functions/index";
const TEST_SERVER_URL: &str = "https://graphql.org/graphql/";

#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_valid_graphql_request_no_variables() {
//* Given
let client = reqwest::Client::new();
Expand Down Expand Up @@ -87,7 +86,6 @@ async fn send_valid_graphql_request_no_variables() {
}

#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_valid_graphql_request_with_variables() {
//* Given
let client = reqwest::Client::new();
Expand Down Expand Up @@ -161,7 +159,6 @@ async fn send_valid_graphql_request_with_variables() {

// https://graphql.github.io/graphql-over-http/draft/#sec-application-json.Examples.Document-parsing-failure
#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_invalid_request_document_parsing_failure() {
//* Given
let client = reqwest::Client::new();
Expand Down Expand Up @@ -189,7 +186,6 @@ async fn send_invalid_request_document_parsing_failure() {

// https://graphql.github.io/graphql-over-http/draft/#sec-application-json.Examples.Field-errors-encountered-during-execution
#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_invalid_request_field_errors_encountered_during_execution_failure() {
//* Given
let client = reqwest::Client::new();
Expand Down Expand Up @@ -230,7 +226,6 @@ async fn send_invalid_request_field_errors_encountered_during_execution_failure(

// https://graphql.github.io/graphql-over-http/draft/#sec-application-json.Examples.Operation-cannot-be-determined
#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_invalid_request_operation_cannot_be_determined_failure_null_operation_name() {
//* Given
let client = reqwest::Client::new();
Expand Down Expand Up @@ -282,13 +277,12 @@ async fn send_invalid_request_operation_cannot_be_determined_failure_null_operat

//* Then
assert_matches!(response, Err(err) => {
assert!(err.to_string().contains(r#"Must provide operation name if query contains multiple operations"#));
assert!(err.to_string().contains(r#"Unable to detect operation AST"#));
});
}

// https://graphql.github.io/graphql-over-http/draft/#sec-application-json.Examples.Operation-cannot-be-determined
#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_invalid_request_operation_cannot_be_determined_failure_invalid_operation_name() {
//* Given
let client = reqwest::Client::new();
Expand Down Expand Up @@ -341,14 +335,12 @@ async fn send_invalid_request_operation_cannot_be_determined_failure_invalid_ope
//* Then
assert_matches!(response, Err(ResponseError::Failure { errors }) => {
assert_eq!(errors.len(), 1);

assert!(errors[0].message.contains(r#"Unknown operation named "invalidOperationName""#));
assert!(errors[0].message.contains(r#"Unable to detect operation AST"#));
});
}

// https://graphql.github.io/graphql-over-http/draft/#sec-application-json.Examples.Variable-coercion-failure
#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_invalid_request_variable_coercion_failure() {
//* Given
let client = reqwest::Client::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use thegraph_graphql_http::http_client::ReqwestExt;
///
/// This a GraphQL server that implements the [Star Wars API](https://swapi.dev/). See
/// https://github.com/graphql/swapi-graphql for more information.
const TEST_SERVER_URL: &str = "https://swapi-graphql.netlify.app/.netlify/functions/index";
const TEST_SERVER_URL: &str = "https://graphql.org/graphql/";

// As `graphql_client` generates code that specifies the query, variables and response types, we
// need to cage them under a module to avoid name collisions.
Expand All @@ -34,7 +34,6 @@ mod test_queries {
}

#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_valid_graphql_request_no_variables() {
//* Given
let client = reqwest::Client::new();
Expand Down Expand Up @@ -103,7 +102,6 @@ async fn send_valid_graphql_request_no_variables() {
}

#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_valid_graphql_request_with_variables() {
//* Given
let client = reqwest::Client::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ use thegraph_graphql_http::{
///
/// This a GraphQL server that implements the [Star Wars API](https://swapi.dev/). See
/// https://github.com/graphql/swapi-graphql for more information.
const TEST_SERVER_URL: &str = "https://swapi-graphql.netlify.app/.netlify/functions/index";
const TEST_SERVER_URL: &str = "https://graphql.org/graphql/";

#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_valid_graphql_request_no_variables() {
//* Given
let client = reqwest::Client::new();
Expand Down Expand Up @@ -89,7 +88,6 @@ async fn send_valid_graphql_request_no_variables() {
}

#[tokio::test]
#[ignore = "Test server unavailable"]
async fn send_valid_graphql_request_with_variables() {
//* Given
let client = reqwest::Client::new();
Expand Down

0 comments on commit 0e44fd1

Please sign in to comment.