Skip to content

Commit 209b49a

Browse files
p-alikweiznich
andauthored
Update wundergraph_cli/src/print_schema/mod.rs
Co-authored-by: Georg Semmler <[email protected]>
1 parent 178a042 commit 209b49a

File tree

1 file changed

+16
-2
lines changed
  • wundergraph_cli/src/print_schema

1 file changed

+16
-2
lines changed

wundergraph_cli/src/print_schema/mod.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,22 @@ mod tests {
328328
client: &reqwest::Client,
329329
listen_url: &str,
330330
body: &'static str,
331-
) -> Result<(), std::string::String> {
332-
let r = client
331+
) -> Result<(), String> {
332+
fn error_mapper<T: std::fmt::Debug>(e: T) -> String {
333+
format!("{:?}", e)
334+
}
335+
336+
let r = client
337+
.post(&format!("http://{}/graphql", listen_url)))
338+
.body(body)
339+
.header(
340+
reqwest::header::CONTENT_TYPE,
341+
reqwest::header::HeaderValue::from_static("application/json"),
342+
).send().map_err(error_mapper)?;
343+
let mut r = r.json::<serde_json::Value>().map_err(error_mapper)?;
344+
std::panic::catch_unwind(|| insta::assert_json_snapshot!(r)).map_err(error_mapper)?;
345+
Ok(())
346+
}
333347
.post(&format!("http://{}/graphql", listen_url))
334348
.body(body)
335349
.header(

0 commit comments

Comments
 (0)