From e0c844ee5893ab77c84edb57378db7dcf3cb71e6 Mon Sep 17 00:00:00 2001 From: lingjhf Date: Sun, 11 Oct 2026 21:23:17 +0000 Subject: [PATCH] Synchronize MCP tests with matching persisted tool responses (#16) --- test/application_tools_test.dart | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/application_tools_test.dart b/test/application_tools_test.dart index e477012..23ac340 100644 --- a/test/application_tools_test.dart +++ b/test/application_tools_test.dart @@ -332,10 +332,13 @@ void main() { String workspace = 'application', String? operation, }) async { + final id = ++requestId; + final elapsed = Stopwatch()..start(); + stdout.writeln('MCP request $id: $name started'); socket.writeln( jsonEncode({ 'jsonrpc': '2.0', - 'id': ++requestId, + 'id': id, 'method': 'tools/call', 'params': { '_meta': { @@ -351,8 +354,19 @@ void main() { }, }), ); - expect(await lines.moveNext().timeout(const Duration(seconds: 5)), true); + await socket.flush(); + // Project tools persist real files. Await their response rather than + // imposing an unrelated transport SLA; the test's timeout bounds hangs. + expect( + await lines.moveNext(), + true, + reason: 'MCP stream closed for $name request $id', + ); + stdout.writeln( + 'MCP request $id: $name replied after ${elapsed.elapsedMilliseconds}ms', + ); final response = jsonDecode(lines.current) as Map; + expect(response['id'], id, reason: '$response'); expect(response['error'], isNull, reason: '$response'); return (response['result'] as Map)['structuredContent'] as Map; }