Question · Angular course · Module 11: Testing

Role of useValue in providers

Why do we use { provide: SamuraiService, useValue: mockService } in tests?

Answer options

  • To inject a prepared mock instead of the real service
  • To copy the real service into the mock
  • To remove the service from the module
  • To run the service in a separate thread

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