-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
91 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
...t/compiletime-codegen/test-compile/modules/posts/src/test/scala/ValidateGraphQlSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import poc.caliban.posts.GraphQLApi | ||
|
||
import scala.io.Source | ||
import java.io.File | ||
import java.nio.file.{Files, Paths} | ||
import zio.test.Assertion._ | ||
import zio.test._ | ||
import caliban.tools._ | ||
import java.nio.file.Path | ||
|
||
class ValidateGraphQlSpec extends ZIOSpecDefault { | ||
object ValidateGraphQlSpec extends SnapshotTest { | ||
override val testName: String = "ValidateGraphQlSpec" | ||
|
||
val graphqlFile= "src/sbt-test/compiletime-codegen/test-compile/modules/posts/src/test/resources/postservice.graphql" | ||
val projectDir = sys.props.get("project.dir").getOrElse("") | ||
|
||
override def spec = | ||
suite("Validate Postservice")( | ||
test("Render postservice as earlier") { | ||
val filename = "postservice.graphql" | ||
val expectedGraphQL: String = Source.fromResource(filename).getLines().mkString("\n") | ||
val gqlApi = GraphQLApi.api | ||
val renderContent: String = s"${gqlApi.render}" | ||
|
||
//Files.writeString(Paths.get(File(s"/tmp/$filename").toURI), renderContent) | ||
|
||
assertTrue(expectedGraphQL == renderContent) | ||
writeAndCompare(Path.of(projectDir).resolve(graphqlFile), renderContent, "Render postservice") | ||
} | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/project/Version.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
object Version { | ||
def pluginVersion: String = | ||
sys.props.get("plugin.version") match { | ||
case Some(x) => x | ||
case _ => sys.error("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters