how can I jest test the following Vue method?
getRealtimeData(conn) {
this.socket = io.connect(this.connection);
this.socket.on(conn, fetchedData => {
this.addData(fetchedData);
})
},
I tried to mock the server as in this link https://socket.io/docs/v3/testing/ and I also tried via jest.fn ():
jest.mock('socket.io-client', () => {
const mSocket = {
on: jest.fn(() => mockData),
connect: jest.fn( )
};
return jest.fn(() => mSocket);
});
but I don't reach the part inside fetchedData, Thx