Question · Angular course · Module 11: Testing

Setting a spy's return value

How do you set the return value of a mock method created with createSpyObj?

Answer options

  • mockService.getAll.returns(of([]))
  • mockService.getAll.and.returnValue(of([]))
  • mockService.getAll.mockReturn(of([]))
  • mockService.getAll = of([])

You can check the correct answer by solving this task in the CodeWorlds game.