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

26 lines
585 B
JavaScript

/**
* Copyright 2004-present Facebook. All Rights Reserved.
*/
'use strict';
jest.enableAutomock().unmock('WebSocket');
jest.setMock('NativeModules', {
WebSocketModule: {
connect: () => {}
}
});
var WebSocket = require('WebSocket');
describe('WebSocket', 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);
});
});