Let sinon.js do this work for you:

```js
sinon.stub(window, 'confirm');
window.confirm.returns(true);
```

then later...

```js
window.confirm.restore();
```