2015-11-06 19:23:29 +00:00
|
|
|
/**
|
2017-11-02 13:14:11 +00:00
|
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-11-02 13:14:11 +00:00
|
|
|
*
|
2018-05-11 02:06:46 +00:00
|
|
|
* @format
|
2017-11-02 13:14:11 +00:00
|
|
|
* @emails oncall+react_native
|
2015-11-06 19:23:29 +00:00
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
|
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: {
|
2018-05-11 02:06:46 +00:00
|
|
|
connect: () => {},
|
|
|
|
},
|
2015-11-06 19:23:29 +00:00
|
|
|
});
|
|
|
|
|
2018-05-10 22:44:52 +00:00
|
|
|
const WebSocket = require('WebSocket');
|
2015-11-06 19:23:29 +00:00
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|