I'm trying to check if a function throws error, and made this:
define([
'doh/runner',
'app/Obj'
], function(
doh,
Obj
){
doh.register('Test Obj exception', [
function () {
try {
new Obj(); // should throw error
} catch(e) {
doh.t(e, 'should give an error if no parameters given');
}
}
]);
Obj.js file:
...
constructor: function (args){
if (!args) { throw 'Error' }
...
}
...
But maybe where is some right method for this thing in Doh ? Can someone explain? Thanks