Seeking assistance for a persistent issue that has been troubling me.
I am currently working on unit tests for a component I developed, and no matter what I try, I can't seem to resolve the recurring problem of an "Expected spy getTopRatedMedia to have been called" message.
This test is supposed to verify if a service method is being invoked, but I keep getting the log message "Expected spy getTopRatedMedia to have been called."
media-list-page.component.ts
Async function onMediaChange(media: string): Promise<void> {
// Component logic here.
}
media-list-page.component.spec.ts
Focusing on testing the functionality of the api method getTopRatedMedia()
mocks.ts
@Injectable({
providedIn: 'root',
})
export class MockedApiService {
// Function returning mocked object
}
Appreciate any assistance provided :)