Skip to content

Commit be1ef5d

Browse files
committed
Tighten remaining shallow text assertions in subgraph preview output
text_for_success_includes_the_schema and text_for_failure_includes_the_errors still used assert!(text.contains(...)) after the earlier pass only fixed the two explicitly-flagged tests in this file. Switched to full-value equality, matching the equivalent (already-tight) tests on the contract side.
1 parent 2687fa4 commit be1ef5d

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/command/subgraph/preview/output.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,29 @@ mod tests {
110110
let mut mock_response = response(AsyncBuildStatus::Success);
111111
mock_response.api_schema = Some("type Query { hello: String }".to_string());
112112
let text = SubgraphPreviewOutput(mock_response).text();
113-
assert!(text.contains("type Query { hello: String }"));
113+
assert_eq!(
114+
text,
115+
indoc! {"
116+
Build id: build-123
117+
Status: SUCCESS
118+
Schema:
119+
120+
type Query { hello: String }"}
121+
);
114122
}
115123

116124
#[test]
117125
fn text_for_failure_includes_the_errors() {
118126
let mut mock_response = response(AsyncBuildStatus::ComposeFailed);
119127
mock_response.errors = vec!["[Accounts] -> Things went really wrong".to_string()];
120128
let text = SubgraphPreviewOutput(mock_response).text();
121-
assert!(text.contains("[Accounts] -> Things went really wrong"));
129+
assert_eq!(
130+
text,
131+
indoc! {"
132+
Build id: build-123
133+
Status: COMPOSE_FAILED
134+
[Accounts] -> Things went really wrong"}
135+
);
122136
}
123137

124138
#[test]

0 commit comments

Comments
 (0)