From 14d19562329aa2d55e5c1bb67d62d0b3f00ef196 Mon Sep 17 00:00:00 2001 From: harttle Date: Sat, 21 Jul 2018 23:23:25 +0800 Subject: [PATCH] test case for _.forOwn --- test/util/underscore.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/util/underscore.js b/test/util/underscore.js index 93370b20d..4375ebe5a 100644 --- a/test/util/underscore.js +++ b/test/util/underscore.js @@ -43,6 +43,11 @@ describe('util/underscore', function () { _.forOwn(obj, spy) expect(spy).to.have.been.calledWith('bar', 'foo', obj) }) + it('should default to empty object', function () { + var spy = sinon.spy() + _.forOwn(undefined, spy) + expect(spy).to.have.not.been.called + }) it('should not iterate over properties on prototype', function () { var spy = sinon.spy() var obj = Object.create({