Skip to content

Commit ad775a3

Browse files
committed
Cleanup the snapshot mess
1 parent a6f16aa commit ad775a3

8 files changed

+11
-191
lines changed

wundergraph_cli/src/print_schema/mod.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ mod tests {
158158

159159
let s = String::from_utf8(out).unwrap();
160160
insta::with_settings!({snapshot_suffix => BACKEND}, {
161-
insta::assert_snapshot!(&s);
161+
insta::assert_snapshot!("infer_schema", &s);
162162
});
163163
}
164164

@@ -320,9 +320,9 @@ mod tests {
320320

321321
let query = "{\"query\": \"{ Users { id name } } \"}";
322322
let mutation = r#"{"query":"mutation CreateUser {\n CreateUser(NewUser: {name: \"Max\"}) {\n id\n name\n }\n}","variables":null,"operationName":"CreateUser"}"#;
323-
let t1 = request_test(&client, &listen_url, query);
324-
let t2 = request_test(&client, &listen_url, mutation);
325-
let t3 = request_test(&client, &listen_url, query);
323+
let t1 = request_test(&client, &listen_url, query, "round_trip_test__query_1");
324+
let t2 = request_test(&client, &listen_url, mutation, "round_trip_test__mutation");
325+
let t3 = request_test(&client, &listen_url, query, "round_trip_test__query_2");
326326

327327
child.kill().unwrap();
328328
child.wait().unwrap();
@@ -336,6 +336,7 @@ mod tests {
336336
client: &reqwest::Client,
337337
listen_url: &str,
338338
body: &'static str,
339+
snapshot_name: &'static str,
339340
) -> Result<(), String> {
340341
fn error_mapper<T: std::fmt::Debug>(e: T) -> String {
341342
format!("{:?}", e)
@@ -351,7 +352,12 @@ mod tests {
351352
.send()
352353
.map_err(error_mapper)?;
353354
let r = r.json::<serde_json::Value>().map_err(error_mapper)?;
354-
std::panic::catch_unwind(|| insta::assert_json_snapshot!(r)).map_err(error_mapper)?;
355+
std::panic::catch_unwind(|| {
356+
insta::with_settings!({snapshot_suffix => ""}, {
357+
insta::assert_json_snapshot!(snapshot_name, r)
358+
})
359+
})
360+
.map_err(error_mapper)?;
355361
Ok(())
356362
}
357363
}

wundergraph_cli/src/print_schema/snapshots/tests__main-2.snap

-9
This file was deleted.

wundergraph_cli/src/print_schema/snapshots/tests__main-3.snap

-17
This file was deleted.

wundergraph_cli/src/print_schema/snapshots/tests__main-4.snap

-9
This file was deleted.

wundergraph_cli/src/print_schema/snapshots/tests__main.snap

-151
This file was deleted.

0 commit comments

Comments
 (0)