Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 5dc4339

Browse files
mtsmfmmhevery
authored andcommitted
fix(WebSocket patch): fix WebSocket constants copy (#299)
fix(WebSocket patch): fix WebSocket constants copy (#299)
1 parent 55da3d8 commit 5dc4339

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: lib/browser/websocket.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ export function apply(_global: any) {
3030

3131
return proxySocket;
3232
};
33-
(<any>global).WebSocket.prototype = Object.create(WS.prototype, {constructor:{value: WebSocket}});
33+
for (var prop in WS) { _global.WebSocket[prop] = WS[prop]; }
3434
}

Diff for: test/browser/WebSocket.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,12 @@ if (!window['soucelabs']) {
118118
done();
119119
}, 100);
120120
}, TIMEOUT);
121+
122+
it('should have constants', function () {
123+
expect(Object.keys(WebSocket)).toContain('CONNECTING');
124+
expect(Object.keys(WebSocket)).toContain('OPEN');
125+
expect(Object.keys(WebSocket)).toContain('CLOSING');
126+
expect(Object.keys(WebSocket)).toContain('CLOSED');
127+
});
121128
}));
122129
}

0 commit comments

Comments
 (0)