Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading