I have a function in my Angular service that does a "this.window.performance.getEntriesByType('navigation')".
But I can't mock it.
Here is my service.spec.ts :
const mockWindowService = jasmine.createSpyObj('WINDOW_TOKEN', ['performance']);
Object.defineProperty(mockWindowService, 'performance', {
value: {
getEntriesByType: { windowPerformanceFixture },
},
});
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [
{ provide: WINDOW_TOKEN, useValue: mockWindowService },
],
});
// My windowPerformanceFixture object is in an external file
here is the error I receive :
TypeError: performance.getEntriesByType is not a function
Do you know how to mock this ?