Using Jasmine, how do I test that a constructor throws an exception when given an invalid parameter? Given the constructor below,
class Obj {
constructor(name) {
if (!name) {
throw new TypeError('\'name\' must be a valid, non-empty string');
}
this._name = name;
}
}
exports.Obj = Obj;
how would I test that this:
var test = new Obj(null);
throws the expected exception?