Stub for a function in Nodejs not executing

Viewed 28

This is a call to a library function,

this.db.update(contactsCollection, ...query);

And this is the stub I wrote.

updateStub = sandbox.stub(preferencesController.db, 'update').resolves({ modifiedCount: 1 });

The stub executes successfully if I remove the spread (...) operator. But in the current scenario, it throws the following error - "found non-callable @@iterator"

Is there a different way to stub a function with variable number of arguments?

0 Answers
Related