Skip to content

Commit

Permalink
Merge pull request #167 from sangria-graphql/query-render
Browse files Browse the repository at this point in the history
test: use QueryRenderer
  • Loading branch information
Soufiane Maguerra authored Aug 22, 2022
2 parents 0377cf2 + ca3f483 commit b7f29a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions core/src/test/scala/sangria/federation/v1/FederationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import sangria.execution.{Executor, VariableCoercionError}
import sangria.federation._
import sangria.macros.LiteralGraphQLStringContext
import sangria.parser.QueryParser
import sangria.renderer.QueryRenderer
import sangria.schema._

class FederationSpec extends AsyncFreeSpec {
Expand Down Expand Up @@ -156,7 +157,7 @@ class FederationSpec extends AsyncFreeSpec {

Executor
.execute(schema, query)
.map(_.renderPretty should be("""{
.map(QueryRenderer.renderPretty(_) should be("""{
| data: {
| _service: {
| sdl: "type Query {\n field: Int\n}"
Expand Down Expand Up @@ -186,7 +187,7 @@ class FederationSpec extends AsyncFreeSpec {

Executor
.execute(schema, query)
.map(_.renderPretty should be("""{
.map(QueryRenderer.renderPretty(_) should be("""{
| data: {
| _service: {
| sdl: "type Query {\n states: [State]\n}\n\ntype State @key(fields: \"id\") {\n id: Int\n value: String\n}"
Expand All @@ -213,7 +214,7 @@ class FederationSpec extends AsyncFreeSpec {

Executor
.execute(schema, query)
.map(_.renderPretty should be("""{
.map(QueryRenderer.renderPretty(_) should be("""{
| data: {
| _service: {
| sdl: "\"The `Long` scalar type represents non-fractional signed whole numeric values. Long can represent values between -(2^63) and 2^63 - 1.\"\nscalar Long\n\ntype Query {\n foo: Long\n bar: Int\n}"
Expand Down Expand Up @@ -253,7 +254,7 @@ class FederationSpec extends AsyncFreeSpec {
AstSchemaBuilder.resolverBased[Any](
FieldResolver.map(
"Query" -> Map(
"states" -> (ctx => Nil)
"states" -> (_ => Nil)
)
),
FieldResolver.map(
Expand Down Expand Up @@ -288,7 +289,7 @@ class FederationSpec extends AsyncFreeSpec {

Executor
.execute(schema, query, variables = args)
.map(_.renderPretty should be("""{
.map(QueryRenderer.renderPretty(_) should be("""{
| data: {
| _entities: [{
| id: 1
Expand Down
11 changes: 6 additions & 5 deletions core/src/test/scala/sangria/federation/v2/FederationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import sangria.execution.{Executor, VariableCoercionError}
import sangria.federation._
import sangria.macros.LiteralGraphQLStringContext
import sangria.parser.QueryParser
import sangria.renderer.QueryRenderer
import sangria.schema._

class FederationSpec extends AsyncFreeSpec {
Expand Down Expand Up @@ -160,7 +161,7 @@ class FederationSpec extends AsyncFreeSpec {

Executor
.execute(schema, query)
.map(_.renderPretty should be("""{
.map(QueryRenderer.renderPretty(_) should be("""{
| data: {
| _service: {
| sdl: "type Query {\n field: Int\n}"
Expand Down Expand Up @@ -190,7 +191,7 @@ class FederationSpec extends AsyncFreeSpec {

Executor
.execute(schema, query)
.map(_.renderPretty should be("""{
.map(QueryRenderer.renderPretty(_) should be("""{
| data: {
| _service: {
| sdl: "type Query {\n states: [State]\n}\n\ntype State @key(fields: \"id\") {\n id: Int\n value: String\n}"
Expand All @@ -217,7 +218,7 @@ class FederationSpec extends AsyncFreeSpec {

Executor
.execute(schema, query)
.map(_.renderPretty should be("""{
.map(QueryRenderer.renderPretty(_) should be("""{
| data: {
| _service: {
| sdl: "\"The `Long` scalar type represents non-fractional signed whole numeric values. Long can represent values between -(2^63) and 2^63 - 1.\"\nscalar Long\n\ntype Query {\n foo: Long\n bar: Int\n}"
Expand Down Expand Up @@ -257,7 +258,7 @@ class FederationSpec extends AsyncFreeSpec {
AstSchemaBuilder.resolverBased[Any](
FieldResolver.map(
"Query" -> Map(
"states" -> (ctx => Nil)
"states" -> (_ => Nil)
)
),
FieldResolver.map(
Expand Down Expand Up @@ -292,7 +293,7 @@ class FederationSpec extends AsyncFreeSpec {

Executor
.execute(schema, query, variables = args)
.map(_.renderPretty should be("""{
.map(QueryRenderer.renderPretty(_) should be("""{
| data: {
| _entities: [{
| id: 1
Expand Down

0 comments on commit b7f29a1

Please sign in to comment.