Skip to content

Commit 9262b2e

Browse files
[Fusion] Add failing interface tests (#8272)
1 parent 2c4db2c commit 9262b2e

20 files changed

+2033
-379
lines changed

src/HotChocolate/Fusion/test/Core.Tests/AutomaticMockingTests.cs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,65 @@ ... on Object {
11231123
""");
11241124
}
11251125

1126+
[Fact]
1127+
public async Task Interface_Multiple_Types_Implementing_Interface()
1128+
{
1129+
// arrange
1130+
var schema =
1131+
"""
1132+
type Query {
1133+
intrface: Interface
1134+
}
1135+
1136+
interface Interface {
1137+
id: ID!
1138+
str: String!
1139+
}
1140+
1141+
type Object1 implements Interface {
1142+
id: ID!
1143+
str: String!
1144+
}
1145+
1146+
type Object2 implements Interface {
1147+
id: ID!
1148+
str: String!
1149+
num: Int!
1150+
}
1151+
""";
1152+
var request =
1153+
"""
1154+
query {
1155+
intrface {
1156+
__typename
1157+
id
1158+
str
1159+
... on Object2 {
1160+
num
1161+
}
1162+
}
1163+
}
1164+
""";
1165+
1166+
// act
1167+
var result = await ExecuteRequestAgainstSchemaAsync(request, schema);
1168+
1169+
// assert
1170+
result.MatchInlineSnapshot(
1171+
"""
1172+
{
1173+
"data": {
1174+
"intrface": {
1175+
"__typename": "Object2",
1176+
"id": "1",
1177+
"str": "string",
1178+
"num": 123
1179+
}
1180+
}
1181+
}
1182+
""");
1183+
}
1184+
11261185
#endregion
11271186

11281187
#region Union

0 commit comments

Comments
 (0)