How to write unit test case for location.back() using Angular Jest

I have tried the following code(Jest runner),

 const location: Location = TestBed.inject(Location);
 component.back();
 console.log('MYLOCATION', location.href);
// expect(location.href).toContain('testUrl');

But in console I get ‘undefined’ for location.href.
Any help would be appreciated.