// Declare a stub function to test let myStub = sinon.stub(); // Call the function twice myStub(); myStub(); // Assert that the function was calledTwice sinon.assert.calledTwice(myStub);In this example, we create a stub function called "myStub" and call it twice. We then use the "calledTwice" assertion from Sinon to verify that the function was called exactly two times. Sinon is an open-source testing library that can be installed via NPM node package.