Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08f12cb

Browse files
committed
Add test to check whether __with__ ignores all returned values which are not a promise
1 parent a04a8ee commit 08f12cb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/__with__.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,21 @@ describe("__with__", function() {
176176
expect(moduleFake.getReference()).to.eql({});
177177
});
178178

179+
it("should ignore any returned value which doesn't provide a then()-method", function () {
180+
expect(moduleFake.getValue()).to.be(0);
181+
expect(moduleFake.getReference()).to.eql({});
182+
183+
moduleFake.__with__({
184+
myValue: 2,
185+
myReference: newObj
186+
})(function () {
187+
return {};
188+
});
189+
190+
expect(moduleFake.getValue()).to.be(0);
191+
expect(moduleFake.getReference()).to.eql({});
192+
});
193+
179194
});
180195

181196
});

0 commit comments

Comments
 (0)