Ken Wheeler e6372719ea Fixes #3846
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
2015-11-06 11:24:29 -08:00

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);
});
});