Skip to content

Commit f6ffa36

Browse files
committed
Add test for stable directive definition
1 parent a78be5d commit f6ffa36

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package graphql.nadel.definition.stubbed
2+
3+
import graphql.introspection.Introspection.DirectiveLocation
4+
import graphql.introspection.Introspection.DirectiveLocation.ENUM
5+
import graphql.introspection.Introspection.DirectiveLocation.FIELD_DEFINITION
6+
import graphql.introspection.Introspection.DirectiveLocation.INPUT_OBJECT
7+
import graphql.introspection.Introspection.DirectiveLocation.OBJECT
8+
import graphql.introspection.Introspection.DirectiveLocation.UNION
9+
import kotlin.test.Test
10+
import kotlin.test.assertTrue
11+
12+
class NadelStubbedDefinitionTest {
13+
@Test
14+
fun `directive name are stable`() {
15+
assertTrue(NadelStubbedDefinition.directiveDefinition.name == "stubbed")
16+
}
17+
18+
@Test
19+
fun `directive locations are stable`() {
20+
// Given
21+
val expectedLocations = setOf(
22+
FIELD_DEFINITION,
23+
OBJECT,
24+
INPUT_OBJECT,
25+
UNION,
26+
ENUM,
27+
)
28+
val actualLocations = NadelStubbedDefinition.directiveDefinition.directiveLocations.mapTo(mutableSetOf()) {
29+
DirectiveLocation.valueOf(it.name)
30+
}
31+
32+
// Then
33+
assertTrue(actualLocations == expectedLocations)
34+
}
35+
}

0 commit comments

Comments
 (0)