Hi!
I found an issue.
There was two problems:
1. jQuery thinks that string is not a valid JSON, so it omits success callback. Changing response body to '{}' instead of 'OK' solves this problem
2. the line this.onSuccessHandler = this.spy(onSuccess); creates new object, which is no longer the same callback as of the time this.handleSubmit() was called. Spying on the callback before calling this.handleSubmit() solves the problem:
/*...*/
this.server.respondWith('POST', '/auth/register', [
200,
{'Content-Type': 'application/json'},
'{}'
]);
this.controller.onRegisterSuccess = this.spy();
this.controller.handleSubmit();
this.server.respond();
/*...*/
assertTrue(this.controller.onRegisterSuccess.called);
Now the test passes.
--
with regards,
Maxim