Fix formatting

This commit is contained in:
Felipe Knorr Kuhn 2021-12-14 23:15:33 -08:00
parent 4bc141cd67
commit bc7bbf5fe5
No known key found for this signature in database
GPG Key ID: 79619B52BB097C1A

View File

@ -31,19 +31,19 @@ export const mockWebSocket = () => {
cy.on('window:before:load', (win) => { cy.on('window:before:load', (win) => {
const winWebSocket = win.WebSocket; const winWebSocket = win.WebSocket;
cy.stub(win, 'WebSocket').callsFake((url) => { cy.stub(win, 'WebSocket').callsFake((url) => {
console.log(url); console.log(url);
if ((new URL(url).pathname.indexOf('/sockjs-node/') !== 0)) { if ((new URL(url).pathname.indexOf('/sockjs-node/') !== 0)) {
const { server, websocket } = createMock(url); const { server, websocket } = createMock(url);
win.mockServer = server; win.mockServer = server;
win.mockServer.on('connection', (socket) => { win.mockServer.on('connection', (socket) => {
win.mockSocket = socket; win.mockSocket = socket;
win.mockSocket.send('{"action":"init"}'); win.mockSocket.send('{"action":"init"}');
}); });
win.mockServer.on('message', (message) => { win.mockServer.on('message', (message) => {
console.log(message); console.log(message);
}); });
return websocket; return websocket;
} else { } else {
@ -89,4 +89,4 @@ export const dropWebSocket = (() => {
win.mockServer.simulate("error"); win.mockServer.simulate("error");
}); });
return cy.wait(500); return cy.wait(500);
}); });