Use `spyOn` to simplify this.  It will automatically restore the original value after the test.

```javascript
spyOn(console, 'log');

// etc

expect(console.log.calls.length).toEqual(2);
```