Skip to content

Commit 8c2e040

Browse files
committed
graphman: add tests for graphman remove graphql api
1 parent 5dff61f commit 8c2e040

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

server/graphman/tests/deployment_mutation.rs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,65 @@ fn graphql_cannot_create_new_subgraph_with_invalid_name() {
328328
assert_ne!(resp, success_resp);
329329
});
330330
}
331+
332+
#[test]
333+
fn graphql_can_remove_subgraph() {
334+
run_test(|| async {
335+
let resp = send_graphql_request(
336+
json!({
337+
"query": r#"mutation RemoveSubgraph {
338+
deployment {
339+
remove(name: "subgraph_1") {
340+
success
341+
}
342+
}
343+
}"#
344+
}),
345+
VALID_TOKEN,
346+
)
347+
.await;
348+
349+
let expected_resp = json!({
350+
"data": {
351+
"deployment": {
352+
"remove": {
353+
"success": true,
354+
}
355+
}
356+
}
357+
});
358+
359+
assert_eq!(resp, expected_resp);
360+
});
361+
}
362+
363+
#[test]
364+
fn graphql_cannot_remove_subgraph_with_invalid_name() {
365+
run_test(|| async {
366+
let resp = send_graphql_request(
367+
json!({
368+
"query": r#"mutation RemoveInvalidSubgraph {
369+
deployment {
370+
remove(name: "*@$%^subgraph") {
371+
success
372+
}
373+
}
374+
}"#
375+
}),
376+
VALID_TOKEN,
377+
)
378+
.await;
379+
380+
let success_resp = json!({
381+
"data": {
382+
"deployment": {
383+
"remove": {
384+
"success": true,
385+
}
386+
}
387+
}
388+
});
389+
390+
assert_ne!(resp, success_resp);
391+
});
392+
}

0 commit comments

Comments
 (0)