Skip to content

Commit 2a978d1

Browse files
authored
Fix testServerHandleInitialize flake (#68)
1 parent 960c1dd commit 2a978d1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Tests/MCPTests/ServerTests.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ struct ServerTests {
3939
try await server.start(transport: transport)
4040

4141
// Wait for message processing and response
42-
try await Task.sleep(nanoseconds: 10_000_000) // 10ms
42+
try await Task.sleep(nanoseconds: 100_000_000) // 100ms
43+
44+
#expect(await transport.sentMessages.count == 2)
4345

44-
#expect(await transport.sentMessages.count == 1)
45-
4646
let messages = await transport.sentMessages
4747
if let response = messages.first {
4848
#expect(response.contains("serverInfo"))
4949
}
5050

51+
if let noticiation = messages.last {
52+
#expect(noticiation.contains("initialized"))
53+
}
54+
5155
// Clean up
5256
await server.stop()
5357
await transport.disconnect()
@@ -136,7 +140,7 @@ struct ServerTests {
136140
#expect(response.contains("error"))
137141
#expect(response.contains("Client not allowed"))
138142
}
139-
143+
140144
await server.stop()
141145
await transport.disconnect()
142146
}

0 commit comments

Comments
 (0)