I am using a selector that is retriving an array of cars, but when I tried to test I am getting:
TypeError: agency.getCars is not a function
describe('selectCars', () => {
it('should return car array', () => {
const stub = jasmine.createSpyObj<AgencyShop>({
findAgency: {
brand: 'BRAND_ID',
name: 'NAME'
getCars: () => ['Rio', 'Soul', 'Sportage']
} as Agency
});
const result = selectCars.projector(stub, {
brand: 'BRAND_ID'
});
expect(result).toEqual(['Rio', 'Soul', 'Sportage']);
});
How is the correct way to mock this function.