From 09b4da57f3f685fa41fc8681b71d90668ab41250 Mon Sep 17 00:00:00 2001 From: Carl-Erik Kopseng Date: Thu, 25 Apr 2024 15:18:27 +0200 Subject: [PATCH] Add regression test for #2572 --- test/issues/issues-test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/issues/issues-test.js b/test/issues/issues-test.js index 64eed2c53..1e8dd7101 100644 --- a/test/issues/issues-test.js +++ b/test/issues/issues-test.js @@ -914,4 +914,16 @@ describe("issues", function () { object.prop; assert.equals(spy.get.callCount, 1); // should remain unchanged }); + + it("#2572 - returns clear callArgAt", function () { + const stub = sinon.stub(); + stub.callsArgWith(0, "Hello").returns("World"); + + const cb = sinon.stub(); + const ret = stub(cb); + + assert.equals(ret, "World"); + assert(cb.calledOnce); + assert.equals(cb.firstCall.args, ["Hello"]); + }); });