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

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

lib/browser/websocket.ts

Lines changed: 1 addition & 1 deletion
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
}

test/browser/WebSocket.spec.ts

Lines changed: 7 additions & 0 deletions
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)