Skip to content

Commit 390e613

Browse files
committed
Correct example 140 unittest which should be valid
1 parent 2796413 commit 390e613

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/ValidationTests.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ TEST_F(ValidationExamplesCase, Example139)
10681068
ASSERT_TRUE(errors.empty());
10691069
}
10701070

1071-
TEST_F(ValidationExamplesCase, CounterExample140)
1071+
TEST_F(ValidationExamplesCase, Example140)
10721072
{
10731073
// http://spec.graphql.org/June2018/#example-41843
10741074
auto query = R"(fragment catOrDogNameFragment on CatOrDog {
@@ -1079,11 +1079,15 @@ TEST_F(ValidationExamplesCase, CounterExample140)
10791079
10801080
fragment unionWithObjectFragment on Dog {
10811081
...catOrDogNameFragment
1082+
}
1083+
1084+
query {
1085+
dog {
1086+
...unionWithObjectFragment
1087+
}
10821088
})"_graphql;
10831089

10841090
auto errors = service::buildErrorValues(_service->validate(query)).release<response::ListType>();
10851091

1086-
EXPECT_EQ(errors.size(), 3) << "1 incompatible type + 2 unused fragment";
1087-
ASSERT_GE(errors.size(), size_t { 1 });
1088-
EXPECT_EQ(R"js({"message":"Incompatible fragment spread target type: catOrDogNameFragment name: CatOrDog","locations":[{"line":8,"column":31}]})js", response::toJSON(std::move(errors[0]))) << "error should match";
1092+
ASSERT_TRUE(errors.empty());
10891093
}

0 commit comments

Comments
 (0)