Skip to content

Commit d11673f

Browse files
committed
Add client/server version negotiation tests without mocks
* In src/client/index.test.ts added tests: - "should connect new client to old, supported server version" - should negotiate version when client is old, and newer server supports its version" - "should throw when client is old, and server doesn't support its version"
1 parent f2f030e commit d11673f

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

src/client/index.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,6 @@ test("should connect new client to old, supported server version", async () => {
222222
server.connect(serverTransport),
223223
]);
224224

225-
// These should work
226-
// Connection should succeed with the older version
227225
expect(client.getServerVersion()).toEqual({
228226
name: "old server",
229227
version: "1.0",
@@ -287,8 +285,6 @@ test("should negotiate version when client is old, and newer server supports its
287285
server.connect(serverTransport),
288286
]);
289287

290-
// These should work
291-
// Connection should succeed with the older version
292288
expect(client.getServerVersion()).toEqual({
293289
name: "new server",
294290
version: "1.0",
@@ -348,9 +344,6 @@ test("should throw when client is old, and server doesn't support its version",
348344
},
349345
);
350346

351-
let closed = false;
352-
clientTransport.onerror = () => {closed = true};
353-
354347
await Promise.all([
355348
expect(client.connect(clientTransport)).rejects.toThrow(
356349
"Server's protocol version is not supported: FUTURE_VERSION"

0 commit comments

Comments
 (0)