Я уверен, что API вызывается несколько раз, я хочу определить, сколько раз вызывается API, я использую httptestingcontroller для этой цели.
const req = httpMock.expectOne ('/ api / getrecords');не удается
it('should return one object', () => {
var dummyObject : any[];
dummyObject = [
{
account: "shjdhjhs",
produc: "xyz",
feature: "ejfjf",
}
];
const req = httpMock.expectOne('/api/getrecords');
//fails, as this api is called many times
expect(req.request.method).toBe("GET");
req.flush( dummyObject);
expect(component.Financials.length).toBe(1);
expect(component.Financials).toEqual( dummyObject);
//test for how many times this api is getting called?
});