@@ -17,6 +17,7 @@ import caliban.schema.Annotations.GQLOneOfInput
17
17
import caliban .schema .Schema .auto ._
18
18
import caliban .schema .ArgBuilder .auto ._
19
19
import caliban .schema .{ ArgBuilder , Schema }
20
+ import zio .stream .ZStream
20
21
import zio .{ IO , ZIO }
21
22
import zio .test .Assertion ._
22
23
import zio .test ._
@@ -101,14 +102,41 @@ object RenderingSpec extends ZIOSpecDefault {
101
102
assertTrue(graphQL(InvalidSchemas .resolverEmpty).render.trim == " " )
102
103
},
103
104
test(
104
- " it should render a schema extension with schema directives even if no queries, mutations, or subscription "
105
+ " it should render a schema extension with directives only "
105
106
) {
106
107
val renderedType =
107
108
graphQL(InvalidSchemas .resolverEmpty, schemaDirectives = List (SchemaDirectives .Link )).render.trim
108
109
assertTrue(
109
110
renderedType == """ extend schema @link(url: "https://example.com", import: ["@key", {name: "@provides", as: "@self"}])"""
110
111
)
111
112
},
113
+ test(" it should render a schema extension with directives and a mutation" ) {
114
+ val resolver = RootResolver (
115
+ Option .empty[Unit ],
116
+ Some (MutationIO (_ => ZIO .unit)),
117
+ Option .empty[Unit ]
118
+ )
119
+ val renderedType = graphQL(resolver, schemaDirectives = List (SchemaDirectives .Link )).render.trim
120
+ assertTrue(renderedType.startsWith(" extend schema" ))
121
+ },
122
+ test(" it should render a schema extension with directives and a subscription" ) {
123
+ val resolver = RootResolver (
124
+ Option .empty[Unit ],
125
+ Option .empty[Unit ],
126
+ Some (SubscriptionIO (ZStream .empty))
127
+ )
128
+ val renderedType = graphQL(resolver, schemaDirectives = List (SchemaDirectives .Link )).render.trim
129
+ assertTrue(renderedType.startsWith(" extend schema" ))
130
+ },
131
+ test(" it should render a schema extension with a subscription and mutation but no directives" ) {
132
+ val resolver = RootResolver (
133
+ Option .empty[Unit ],
134
+ Some (MutationIO (_ => ZIO .unit)),
135
+ Some (SubscriptionIO (ZStream .empty))
136
+ )
137
+ val renderedType = graphQL(resolver).render.trim
138
+ assertTrue(renderedType.startsWith(" extend schema" ))
139
+ },
112
140
test(" it should render object arguments in type directives" ) {
113
141
val testType = __Type(
114
142
__TypeKind.OBJECT ,
0 commit comments