Skip to content

Mocks and Spies (spyOn)

Spies monitor function calls during tests.

it("should call service method", () => {
const service = jasmine.createSpyObj("DataService", ["getData"]);
service.getData.and.returnValue("test");
expect(service.getData()).toBe("test");
});