From 08f12cbb785cbe77b50763c72d2a955fcee3aa56 Mon Sep 17 00:00:00 2001 From: Johannes Ewald Date: Thu, 10 Jul 2014 19:31:55 +0200 Subject: Add test to check whether __with__ ignores all returned values which are not a promise --- test/__with__.test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/__with__.test.js b/test/__with__.test.js index 3cd4b57..c4f7539 100644 --- a/test/__with__.test.js +++ b/test/__with__.test.js @@ -176,6 +176,21 @@ describe("__with__", function() { expect(moduleFake.getReference()).to.eql({}); }); + it("should ignore any returned value which doesn't provide a then()-method", function () { + expect(moduleFake.getValue()).to.be(0); + expect(moduleFake.getReference()).to.eql({}); + + moduleFake.__with__({ + myValue: 2, + myReference: newObj + })(function () { + return {}; + }); + + expect(moduleFake.getValue()).to.be(0); + expect(moduleFake.getReference()).to.eql({}); + }); + }); }); -- cgit v1.2.3