Skip to content

Commit

Permalink
Merge pull request #328 from sangria-graphql/test_unparsable_argument
Browse files Browse the repository at this point in the history
test unparsable arguments
  • Loading branch information
yanns authored Jun 27, 2024
2 parents d64cf7b + 465c3eb commit 3361bf0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions core/src/test/scala/sangria/federation/v2/ResolverSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,36 @@ class ResolverSpec extends AnyWordSpec with Matchers {
| }
|}""".stripMargin)
}

"handles non-parsable arguments" in {
val testApp = AppWithResolvers()

val args: Json = parse(s"""
{
"representations": [
{ "__typename": "State", "id": 1 },
{ "__typename": "State", "id": "bla bla" }
]
}
""").getOrElse(Json.Null)

val result = testApp.execute(fetchStateAndReview, args)

QueryRenderer.renderPretty(result) should be("""{
| data: null
| errors: [{
| message: "Internal server error"
| path: ["_entities"]
| locations: [{
| line: 3
| column: 8
| }]
| }]
|}""".stripMargin)

testApp.testApp.db.stateDbCalled.get() should be(0)
testApp.testApp.db.reviewDbCalled.get() should be(0)
}
}
}

Expand Down

0 comments on commit 3361bf0

Please sign in to comment.