import { SinonStub } from 'sinon'; class Calculator { public addTwoNumbers(a: number, b: number): number { return a + b; } } describe('Calculator', () => { let calculator: Calculator; let addTwoNumbersStub: SinonStub; beforeEach(() => { calculator = new Calculator(); addTwoNumbersStub = sinon.stub(calculator, 'addTwoNumbers'); }); afterEach(() => { addTwoNumbersStub.restore(); }); it('should add two numbers', () => { addTwoNumbersStub.returns(5); expect(calculator.addTwoNumbers(2, 3)).toEqual(5); }); });In this example, we have a simple class `Calculator` with a method `addTwoNumbers` that adds two numbers together. We are using SinonStub to create a stub for this method so that we can test it in isolation. First, we import `SinonStub` from the Sinon library. Then, we create a new instance of our `Calculator` class and a SinonStub for its `addTwoNumbers` method. We use `sinon.stub` to create the stub and pass in the `Calculator` instance and the name of the method we want to stub. In our test, we set the stub to return `5` when called with any arguments. Then, we call `addTwoNumbers` with the arguments `2` and `3` and expect it to return `5`. Since we have set up a SinonStub, we are testing the method in isolation without actually executing it. The package library for Sinon is `sinon`.