Skip to content

Commit d19ca79

Browse files
Added test to verify value, property name and context are passed to applied function
1 parent cafc995 commit d19ca79

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

applicators.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ describe('perform', function() {
2323
expect(fn).to.have.been.calledWith(obj.a.b2.c);
2424
});
2525

26+
it('should pass value, property, context to the function', function() {
27+
const fn = sinon.spy();
28+
const c = obj.a.b1.c;
29+
30+
perform('a.b1.c', fn, obj);
31+
32+
expect(fn).to.have.been.calledWith(c, 'c', sinon.match.same(obj.a.b1));
33+
});
34+
2635
it('should set matching properties to the result value', function() {
2736
const fn = x => x + 1;
2837
const expected = structuredClone(obj);

0 commit comments

Comments
 (0)