I have a class which use Socket
as a private property.
import {Socket} from 'socket.io-client';
export class SocketService {
private socket: Socket;
public initializeSocket() {
if(this.socket) { return; }
this.socket = // get a new Socket
this.socket.on('connect', () => this.processConnect() );
}
private processConnect() {
...
}
}
How should I mock this Socket
and validate on
is called. Any suggestion would be appreciated!