mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +00:00
test(mcp): share evidence server handshake setup (#16237)
This commit is contained in:
1 parent
0c37579726
commit
b3ad7ec381
1 file changed
+27
-54
@@ -974,6 +974,30 @@ const responseFor = (
|
||||
message.id === id,
|
||||
);
|
||||
|
||||
const initializeClient = async (
|
||||
clientTransport: InMemoryTransport,
|
||||
received: readonly unknown[],
|
||||
): Promise<void> => {
|
||||
await clientTransport.start();
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
id: 0,
|
||||
method: "initialize",
|
||||
params: {
|
||||
protocolVersion: "2025-11-25",
|
||||
capabilities: {},
|
||||
clientInfo: { name: "dup-client", version: "1" },
|
||||
},
|
||||
});
|
||||
await expect
|
||||
.poll(() => responseFor(received, 0, "result"))
|
||||
.toMatchObject({ id: 0 });
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
method: "notifications/initialized",
|
||||
});
|
||||
};
|
||||
|
||||
const holdResultSend = (
|
||||
transport: {
|
||||
send: (message: JSONRPCMessage, ...rest: never[]) => Promise<void>;
|
||||
@@ -1196,24 +1220,7 @@ describe("duplicate in-flight request IDs", () => {
|
||||
const serving = serveStdio(() => server, { transport: serverTransport });
|
||||
const testLifetime = createDeferred<void>();
|
||||
try {
|
||||
await clientTransport.start();
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
id: 0,
|
||||
method: "initialize",
|
||||
params: {
|
||||
protocolVersion: "2025-11-25",
|
||||
capabilities: {},
|
||||
clientInfo: { name: "dup-client", version: "1" },
|
||||
},
|
||||
});
|
||||
await expect
|
||||
.poll(() => responseFor(received, 0, "result"))
|
||||
.toMatchObject({ id: 0 });
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
method: "notifications/initialized",
|
||||
});
|
||||
await initializeClient(clientTransport, received);
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
id: 11,
|
||||
@@ -1328,24 +1335,7 @@ describe("duplicate in-flight request IDs", () => {
|
||||
const serving = serveStdio(() => server, { transport: serverTransport });
|
||||
const testLifetime = createDeferred<void>();
|
||||
try {
|
||||
await clientTransport.start();
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
id: 0,
|
||||
method: "initialize",
|
||||
params: {
|
||||
protocolVersion: "2025-11-25",
|
||||
capabilities: {},
|
||||
clientInfo: { name: "dup-client", version: "1" },
|
||||
},
|
||||
});
|
||||
await expect
|
||||
.poll(() => responseFor(received, 0, "result"))
|
||||
.toMatchObject({ id: 0 });
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
method: "notifications/initialized",
|
||||
});
|
||||
await initializeClient(clientTransport, received);
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
id: 7,
|
||||
@@ -1468,24 +1458,7 @@ describe("duplicate in-flight request IDs", () => {
|
||||
const serving = serveStdio(() => server, { transport: serverTransport });
|
||||
const testLifetime = createDeferred<void>();
|
||||
try {
|
||||
await clientTransport.start();
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
id: 0,
|
||||
method: "initialize",
|
||||
params: {
|
||||
protocolVersion: "2025-11-25",
|
||||
capabilities: {},
|
||||
clientInfo: { name: "dup-client", version: "1" },
|
||||
},
|
||||
});
|
||||
await expect
|
||||
.poll(() => responseFor(received, 0, "result"))
|
||||
.toMatchObject({ id: 0 });
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
method: "notifications/initialized",
|
||||
});
|
||||
await initializeClient(clientTransport, received);
|
||||
await clientTransport.send({
|
||||
jsonrpc: "2.0",
|
||||
id: 7,
|
||||
|
||||
Reference in new issue
Block a user