mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 17:45:59 +00:00
e6372719ea
Summary: This fixes a leak in regards to web sockets, detailed in #3846 . The connection state constants referenced the class rather than the instance and were coming back undefined. cc brentvatne stephenelliot Closes https://github.com/facebook/react-native/pull/3896 Reviewed By: svcscm Differential Revision: D2626399 Pulled By: vjeux fb-gh-sync-id: f42670003b68ed5b86f078d7ed74c2695f30fc69
27 lines
606 B
JavaScript
27 lines
606 B
JavaScript
/**
|
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
|
*/
|
|
'use strict';
|
|
|
|
jest.dontMock('WebSocket');
|
|
jest.dontMock('WebSocketBase');
|
|
jest.setMock('NativeModules', {
|
|
WebSocketModule: {
|
|
connect: () => {}
|
|
}
|
|
});
|
|
|
|
var WebSocket = require('WebSocket');
|
|
|
|
describe('WebSocketBase', function() {
|
|
|
|
it('should have connection lifecycle constants defined on the class', () => {
|
|
expect(WebSocket.CONNECTING).toEqual(0);
|
|
});
|
|
|
|
it('should have connection lifecycle constants defined on the instance', () => {
|
|
expect(new WebSocket('wss://echo.websocket.org').CONNECTING).toEqual(0);
|
|
});
|
|
|
|
});
|