What is the main points of testing xmpp client?
I'm writing a chat, sort of XMPP client using JsJac library. Now I need to test behavior of my client after different server signals. For instance - that when server send's some error to my client - it would trigger ondisconnect
callback. I also should test (in separate test) that when this callback triggered - certain conditions are met.
The question is should I do connection to real server in any test or I can somehow write some mock for it?
I can emulate server messages in such a way (CoffeeScript code):
error = JSJaCError '503', 'cancel', 'service-unavailable'
xmpp._handleEvent 'onerror', error
but the problem is that xmpp object should be in connected state to do this.