Skip to content

Commit

Permalink
switch to shorter json snapshot code
Browse files Browse the repository at this point in the history
All credits goes to @Geal
  • Loading branch information
IvanGoncharov committed Sep 18, 2024
1 parent b411e5f commit ddeed8d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apollo-router/tests/integration/subgraph_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn test_subgraph_returning_data_null() -> Result<(), BoxError> {
let (_trace_id, response) = router.execute_query(&json!({ "query": query })).await;
assert_eq!(response.status(), 200);
assert_eq!(
serde_json::from_str::<serde_json::Value>(&response.text().await?)?,
response.json::<serde_json::Value>().await?,
json!({ "data": null })
);
Ok(())
Expand Down Expand Up @@ -67,7 +67,7 @@ async fn test_subgraph_returning_different_typename_on_query_root() -> Result<()
let (_trace_id, response) = router.execute_query(&json!({ "query": query })).await;
assert_eq!(response.status(), 200);
assert_eq!(
serde_json::from_str::<serde_json::Value>(&response.text().await?)?,
response.json::<serde_json::Value>().await?,
json!({
"data": {
"topProducts": null,
Expand Down Expand Up @@ -107,7 +107,7 @@ async fn test_valid_error_locations() -> Result<(), BoxError> {
.await;
assert_eq!(response.status(), 200);
assert_eq!(
serde_json::from_str::<serde_json::Value>(&response.text().await?)?,
response.json::<serde_json::Value>().await?,
json!({
"data": { "topProducts": null },
"errors": [{
Expand Down Expand Up @@ -148,7 +148,7 @@ async fn test_empty_error_locations() -> Result<(), BoxError> {
.await;
assert_eq!(response.status(), 200);
assert_eq!(
serde_json::from_str::<serde_json::Value>(&response.text().await?)?,
response.json::<serde_json::Value>().await?,
json!({
"data": { "topProducts": null },
"errors": [{
Expand Down Expand Up @@ -185,7 +185,7 @@ async fn test_invalid_error_locations() -> Result<(), BoxError> {
.await;
assert_eq!(response.status(), 200);
assert_eq!(
serde_json::from_str::<serde_json::Value>(&response.text().await?)?,
response.json::<serde_json::Value>().await?,
json!({
"data": null,
"errors": [{
Expand Down Expand Up @@ -227,7 +227,7 @@ async fn test_invalid_error_locations_with_single_negative_one_location() -> Res
.await;
assert_eq!(response.status(), 200);
assert_eq!(
serde_json::from_str::<serde_json::Value>(&response.text().await?)?,
response.json::<serde_json::Value>().await?,
json!({
"data": { "topProducts": null },
"errors": [{
Expand Down Expand Up @@ -268,7 +268,7 @@ async fn test_invalid_error_locations_contains_negative_one_location() -> Result
.await;
assert_eq!(response.status(), 200);
assert_eq!(
serde_json::from_str::<serde_json::Value>(&response.text().await?)?,
response.json::<serde_json::Value>().await?,
json!({
"data": { "topProducts": null },
"errors": [{
Expand Down

0 comments on commit ddeed8d

Please sign in to comment.