I created a simple Restify server, and started testing its functionality through Mocha using its own JSONclient.
When Unit Testing functionality, it's possible to set an ENV var indicating a testing setup, and connect to the according mongodb database.
However, when using the JSONClient you, obviously, test the 'running' API server, which is already connected.
Is there any way to end-to-end test API functionality through the client by swithing database-connections as to not overwrite the development database?
Edit: I suppose I could add a method to the api along the lines of "switchDataConnection" which would switch to the testing database, but that feels dirty and hacky.