Skip to content

Instantly share code, notes, and snippets.

@hideack
Created September 11, 2020 23:50
Show Gist options
  • Select an option

  • Save hideack/ade1d3ddae7e59653e17ce69aa71db8d to your computer and use it in GitHub Desktop.

Select an option

Save hideack/ade1d3ddae7e59653e17ce69aa71db8d to your computer and use it in GitHub Desktop.
// test/foo.test.js
var should = require('should');
function Foo() {
return {
hoge: function(val) {
if (val == '') {
throw new Error('fail');
}
return val;
}
};
}
var foo = Foo();
describe('Foo', function() {
describe('#sample1', function() {
it('equal test', function(){
foo.hoge('bar').should.equal('bar');
});
});
describe('#sample2', function() {
it('exception test', function(){
(function(){ foo.hoge('') }).should.throw();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment