File tree 4 files changed +80
-1
lines changed
codegen-sbt/src/sbt-test/compiletime-codegen/test-compile
4 files changed +80
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ lazy val sttp = Seq(
38
38
" com.softwaremill.sttp.client3" %% " zio" % " 3.9.8"
39
39
)
40
40
41
+ lazy val munit = Seq (" org.scalameta" %% " munit" % " 1.0.0" % Test )
41
42
// ### App Modules ###
42
43
43
44
/**
@@ -103,7 +104,7 @@ lazy val posts =
103
104
)
104
105
)
105
106
)
106
- .settings(libraryDependencies ++= calibanLib)
107
+ .settings(libraryDependencies ++= calibanLib ++ munit )
107
108
108
109
lazy val potatoes =
109
110
project
Original file line number Diff line number Diff line change
1
+ schema {
2
+ query : Query
3
+ mutation : Mutation
4
+ subscription : Subscription
5
+ }
6
+ scalar Unit
7
+
8
+ input AuthorNameInput {
9
+ name : String !
10
+ }
11
+
12
+ input PostContentInput {
13
+ content : String !
14
+ }
15
+
16
+ input PostTitleInput {
17
+ title : String !
18
+ }
19
+
20
+ type AuthorName {
21
+ name : String !
22
+ }
23
+
24
+ type Mutation {
25
+ createPost (authorName : AuthorNameInput ! , title : PostTitleInput ! , content : PostContentInput ! ): Post
26
+ deletePost (id : ID ! ): Unit
27
+ }
28
+
29
+ type Post {
30
+ id : PostId !
31
+ author : AuthorName !
32
+ title : PostTitle !
33
+ content : PostContent !
34
+ }
35
+
36
+ type PostContent {
37
+ content : String !
38
+ }
39
+
40
+ type PostId {
41
+ id : ID !
42
+ }
43
+
44
+ type PostTitle {
45
+ title : String !
46
+ }
47
+
48
+ type Query {
49
+ postById (id : ID ! ): Post
50
+ }
51
+
52
+ type Subscription {
53
+ allPostsByAuthor (name : String ! ): Post
54
+ }
Original file line number Diff line number Diff line change
1
+ import poc .caliban .posts .GraphQLApi
2
+
3
+ import scala .io .Source
4
+ import munit .FunSuite
5
+ import java .io .File
6
+ import java .nio .file .{Files , Paths }
7
+
8
+ class ValidateGraphQLTest extends FunSuite {
9
+
10
+ if (scala.util.Properties .versionNumberString.startsWith(" 3." )) {
11
+ test(" validate postservice.graphql for scala 3" ) {
12
+ val filename = " postservice_scala3.graphql"
13
+ val expectedGraphQL : String = Source .fromResource(filename).getLines().mkString(" \n " )
14
+ val gqlApi = GraphQLApi .api
15
+ val renderContent : String = s " ${gqlApi.render}"
16
+
17
+ // Files.writeString(Paths.get(File(s"/tmp/$filename").toURI), renderContent)
18
+
19
+ assertEquals(expectedGraphQL, renderContent)
20
+ }
21
+ }
22
+ }
Original file line number Diff line number Diff line change @@ -201,3 +201,5 @@ $ exists modules/potatoes-clients/src/main/scala/poc/caliban/client/generated/po
201
201
-$ newer modules/posts/target/ctCalibanServer/touch modules/posts/target/ctCalibanServer/touch_old
202
202
# TODO: This should be newer, sadly I don't find how to make it work.
203
203
-$ newer modules/posts-clients/target/scala-2.12/src_managed/main/poc/caliban/client/generated/posts/CalibanClient.scala modules/posts-clients/tmp/CalibanClient.scala.old
204
+
205
+ > reload; test
You can’t perform that action at this time.
0 commit comments