From 21950295acf3c7c7438168f3eff750ddbacf2bf9 Mon Sep 17 00:00:00 2001 From: harttle Date: Sun, 6 Nov 2016 15:26:39 +0800 Subject: [PATCH] unit test for _.echo --- test/util/underscore.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/util/underscore.js b/test/util/underscore.js index da673c62b..91e0a112f 100644 --- a/test/util/underscore.js +++ b/test/util/underscore.js @@ -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'); + }); + }); });