2015-11-06 19:23:29 +00:00
|
|
|
/**
|
2017-11-02 13:14:11 +00:00
|
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*
|
|
|
|
* @emails oncall+react_native
|
2015-11-06 19:23:29 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2017-06-08 14:36:21 +00:00
|
|
|
jest.enableAutomock().unmock('WebSocket');
|
2015-11-06 19:23:29 +00:00
|
|
|
jest.setMock('NativeModules', {
|
|
|
|
WebSocketModule: {
|
|
|
|
connect: () => {}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var WebSocket = require('WebSocket');
|
|
|
|
|
2016-04-18 22:42:42 +00:00
|
|
|
describe('WebSocket', function() {
|
2015-11-06 19:23:29 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|