Integration tests should be added to ensure that Resgate complies with the RES client-, and service protocol specification.
Notes
Mocking both the NATS client behaviour as well as the WebSocket client connection, tests can be made that sends client requests, validates and replies to requests posted on NATS, and validates the responses to the client.
Mocking NATS
By creating a testnats struct that implements the mq.Client interface, NATS client may be mocked.
Mocking WebSocket client
By using github.com/posener/wstest, the clients may be mocked as well.
Story
Integration tests should be added to ensure that Resgate complies with the RES client-, and service protocol specification.
Notes
Mocking both the NATS client behaviour as well as the WebSocket client connection, tests can be made that sends client requests, validates and replies to requests posted on NATS, and validates the responses to the client.
Mocking NATS
By creating a testnats struct that implements the mq.Client interface, NATS client may be mocked.
Mocking WebSocket client
By using
github.com/posener/wstest
, the clients may be mocked as well.