Skip to content

Commit 87c1c04

Browse files
committed
Add default argument to GraphQLErrorResultMatcher.path function
1 parent b98a91a commit 87c1c04

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/kotlin/com/symbaloo/graphql/test/GraphQLKotlinTestDsl.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fun GraphQLResultActionsDsl.andReturn(): ExecutionResult {
128128
* @see GraphQLResultMatcherDsl.path
129129
*/
130130
fun <T> GraphQLResultActionsDsl.andReturnPath(path: String): T {
131-
return JsonPathContext(executionResult.getData<Any>()).readJsonPathOrFail(path)
131+
return JsonPathContext(executionResult.getData()).readJsonPathOrFail(path)
132132
}
133133

134134
class GraphQLResultMatcherDsl(internal val executionResult: ExecutionResult)
@@ -192,7 +192,7 @@ fun <T> GraphQLResultMatcherDsl.rootFieldEqualTo(key: String, expected: T) {
192192
* Parse the [ExecutionResult] data into a [GraphQLJsonResultMatcherDsl] DSL
193193
*/
194194
fun <R> GraphQLResultMatcherDsl.json(fn: GraphQLJsonResultMatcherDsl.() -> R): R {
195-
val context = JsonPathContext(executionResult.getData<Any>())
195+
val context = JsonPathContext(executionResult.getData())
196196
return GraphQLJsonResultMatcherDsl(context).fn()
197197
}
198198

@@ -297,7 +297,7 @@ internal class JsonPathContext(
297297

298298
class GraphQLErrorResultMatcher(internal val errors: List<GraphQLError>)
299299

300-
fun <R> GraphQLErrorResultMatcher.path(path: String, matcher: (GraphQLError) -> R) {
300+
fun GraphQLErrorResultMatcher.path(path: String, matcher: (GraphQLError) -> Unit = { }) {
301301
val parts = path.split(".")
302302
when (val error = errors.find { it.path == parts }) {
303303
null -> fail("Error with path '$path' couldn't be found", path, errors)

0 commit comments

Comments
 (0)