I have the following constructor which takes a few parameters.
constructor(url: string, mqttOptions: MqttOptions, messageReceivedCallBack: IMessageReceivedCallBack) {
if (!_.isString(url) || _.isEmpty(mqttOptions || _.isEmpty(messageReceivedCallBack))) {
throw new MyNodeError('invalid url value');
} else {
this.createConnection(url,mqttOptions);
}
}
How can I create a spy instance using sinon in order to verify that an exception is thrown when one of the parameters is empty? I saw this question Mocking JavaScript constructor with Sinon.JS but its a constructor with no parameters. Any help would be much appreciated.