unit test for _.echo

This commit is contained in:
harttle
2016-11-06 15:26:39 +08:00
parent d7b7b1724f
commit 21950295ac
+10
View File
@@ -53,4 +53,14 @@ describe('util/underscore', function() {
expect(_.isArray("foo")).to.be.false;
});
});
describe('.echo()', function(){
it('should be transparent when called', function() {
expect(_.echo('foo')('bar')).to.equal('bar');
});
it('should log the arguments', function() {
var log = sinon.spy(console, 'log');
_.echo('foo')('bar');
expect(log).to.have.been.calledWith('[foo]', 'bar');
});
});
});