I'm currently facing an issue with my service method and unit test setup. Despite writing a unit test for the getter method, the coverage report indicates that this method is not covered. I would appreciate any advice on what might be going wrong in my unit test implementation.
export class ItemService{
#item: Item;
get item(): Item{
return this.#item;
}
}
import itemMock from '../mocks/item-response.json';
describe('ItemService', () => {
let itemService: ItemService;
it('should get item information', () => {
itemService['#item'] = itemMock ;
spyOnProperty(itemService, 'item').and.returnValue(itemMock);
expect(itemService['#item']).toEqual(itemMock );
});
}