Skip to content

Commit 8de448f

Browse files
committed
[test] Fix failing tests
Refs: e173423c
1 parent 91f3c07 commit 8de448f

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

test/websocket.integration.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ describe('WebSocket', () => {
99
const ws = new WebSocket('ws://websocket-echo.com/', {
1010
protocolVersion: 13
1111
});
12-
const str = Date.now().toString();
1312

1413
let dataReceived = false;
1514

16-
ws.on('open', () => ws.send(str));
15+
ws.on('open', () => {
16+
ws.send('hello');
17+
});
18+
1719
ws.on('close', () => {
1820
assert.ok(dataReceived);
1921
done();
2022
});
21-
ws.on('message', (data) => {
23+
24+
ws.on('message', (message, isBinary) => {
2225
dataReceived = true;
23-
assert.strictEqual(data, str);
26+
assert.ok(!isBinary);
27+
assert.strictEqual(message.toString(), 'hello');
2428
ws.close();
2529
});
2630
});
@@ -29,18 +33,22 @@ describe('WebSocket', () => {
2933
const ws = new WebSocket('wss://websocket-echo.com/', {
3034
protocolVersion: 13
3135
});
32-
const str = Date.now().toString();
3336

3437
let dataReceived = false;
3538

36-
ws.on('open', () => ws.send(str));
39+
ws.on('open', () => {
40+
ws.send('hello');
41+
});
42+
3743
ws.on('close', () => {
3844
assert.ok(dataReceived);
3945
done();
4046
});
41-
ws.on('message', (data) => {
47+
48+
ws.on('message', (message, isBinary) => {
4249
dataReceived = true;
43-
assert.strictEqual(data, str);
50+
assert.ok(!isBinary);
51+
assert.strictEqual(message.toString(), 'hello');
4452
ws.close();
4553
});
4654
});

0 commit comments

Comments
 (0)