mirror of https://github.com/sbt/sbt.git
[2.x] test: Add test for error response to unknown JSON-RPC method
This test fails against the current code — the server silently drops requests with unknown methods instead of responding with an error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7218b2a1ac
commit
4f01a75887
|
|
@ -79,6 +79,16 @@ class ResponseTest extends AbstractServerTest {
|
|||
}
|
||||
}
|
||||
|
||||
test("unknown method returns error") {
|
||||
val id = svr.session.nextId()
|
||||
svr.session.sendJsonRpc(id, "build/foo", "{}").get
|
||||
val response = svr.session.waitForResponseMsg(10.seconds, id).get
|
||||
assert(
|
||||
response.error.exists(_.code == -32601),
|
||||
s"Expected method-not-found error, got: $response"
|
||||
)
|
||||
}
|
||||
|
||||
private def neverReceiveResponse(
|
||||
duration: FiniteDuration
|
||||
)(predicate: sbt.internal.protocol.JsonRpcResponseMessage => Boolean): Unit =
|
||||
|
|
|
|||
Loading…
Reference in New Issue