I am facing a challenge with my testing setup where I have a series of tests that utilize knockout validation. Before calling the API that I intend to test, a check for a valid email is implemented.
jasmine.Ajax.stubRequest('/api/register/').andReturn({
'status': 201,
'contentType': 'application/json',
'responseText': '{"result":"ok"}',
});
jasmine.Ajax.stubRequest('/api/email-ok/?email=test%40example.com').andReturn({
'status': 200,
'contentType': 'application/json',
'responseText': 'true',
});
var u = new User();
u.registrationEmail('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e0a1b0d0a3e1b061f130e121b501d1113">[email protected]</a>');
var d = u.register('/api/register/');
d.then(() => {
var request = jasmine.Ajax.requests.mostRecent();
....
I am having difficulty in distinguishing between the two mock calls made with jasmine.Ajax - one for email validation and the other for registration. This is causing confusion in verifying the results. Any insights on how I can differentiate between these two mock calls to accurately check the outcome?