2

We are trying to do unit testing with Jasmine to isolate a method or component that we need to test and see how it behaves under a variety of circumstances.

return Promise.resolve(referenceObject()) //afraid this might execute out of order so force it inside promise chain.
           .then(() => this._apiClient.postRequest('putquestions', requestParametersPutSamples, questionInfo))
           .then(() => this._apiClient.postRequest('putitems', requestParametersPutNewSamples, { item: itemInfo }))
           .then((res: Array<any>) => this.expectEachResponseToBeOk(res));
   }
   
   

We are using spyOn for the existing methods as shown in the code above. We have forced it inside a promise chain because this might execute out of order.

Any ideas on how can we spyOn on the same method which has been called twice but with different parameters?

Thanks.

Balachander
  • 430
  • 1
  • 3
  • 15

0 Answers0