react-native/Libraries/WebSocket/__tests__/WebSocket-test.js

27 lines
606 B
JavaScript
Raw Normal View History

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