Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use QueryRenderer #167

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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