Skip to content

Commit e327eed

Browse files
authored
chore(composition): Make assert_composition_errors a strict equality check (#8706)
1 parent 901d659 commit e327eed

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

β€Žapollo-federation/tests/composition/compose_directive_sharing.rsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ fn field_sharing_applies_shareable_on_type_only_to_fields_within_definition() {
311311
&result,
312312
&[(
313313
"INVALID_FIELD_SHARING",
314-
r#"Non-shareable field "A.x" is resolved from multiple subgraphs"#,
314+
r#"Non-shareable field "A.x" is resolved from multiple subgraphs: it is resolved from subgraphs "subgraphA" and "subgraphB" and defined as non-shareable in subgraph "subgraphB""#,
315315
)],
316316
);
317317
}
@@ -454,7 +454,7 @@ fn interface_object_field_requires_shareable() {
454454
&result,
455455
&[(
456456
"INVALID_FIELD_SHARING",
457-
r#"Non-shareable field "Entity.sku" is resolved from multiple subgraphs"#,
457+
r#"Non-shareable field "Entity.sku" is resolved from multiple subgraphs: it is resolved from subgraphs "subgraphA", "subgraphB (through @interfaceObject field "Node.sku")" and "subgraphC" and defined as non-shareable in subgraph "subgraphB (through @interfaceObject field "Node.sku")""#,
458458
)],
459459
);
460460
}

β€Žapollo-federation/tests/composition/compose_validation.rsβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ fn merge_validations_errors_when_a_subgraph_is_invalid() {
3939
3 β”‚ a: A
4040
β”‚ ┬
4141
β”‚ ╰── not found in this scope
42-
───╯"#,
42+
───╯
43+
"#,
4344
)],
4445
);
4546
}
@@ -75,7 +76,8 @@ fn merge_validations_errors_when_subgraph_has_introspection_reserved_name() {
7576
3 β”‚ __someQuery: Int
7677
β”‚ ─────┬─────
7778
β”‚ ╰─────── Pick a different name here
78-
───╯"#,
79+
───╯
80+
"#,
7981
)],
8082
);
8183
}

β€Žapollo-federation/tests/composition/mod.rsβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,16 @@ pub(crate) mod test_helpers {
116116

117117
// Check error code
118118
assert!(
119-
error_code.contains(expected_code),
120-
"Error at index {} does not contain expected code.\n\nEXPECTED:\n{}\nACTUAL:\n{}",
119+
error_code == expected_code,
120+
"Error at index {} does not equal expected code.\n\nEXPECTED:\n{}\nACTUAL:\n{}",
121121
i,
122122
format_args!("code: {}\nmessage: {}\n", expected_code, expected_message),
123123
format_args!("code: {}\nmessage: {}\n", error_code, error_str)
124124
);
125125
// Check error message
126126
assert!(
127-
error_str.contains(expected_message),
128-
"Error at index {} does not contain expected message.\n\nEXPECTED:\n{}\nACTUAL:\n{}",
127+
error_str == expected_message,
128+
"Error at index {} does not equal expected message.\n\nEXPECTED:\n{}\nACTUAL:\n{}",
129129
i,
130130
format_args!("code: {}\nmessage: {}\n", expected_code, expected_message),
131131
format_args!("code: {}\nmessage: {}\n", error_code, error_str)

0 commit comments

Comments
Β (0)