Reuse Supertest tests on a remote URL
mocha.js, node.js, supertest
Solution
You already mentioned it, since you are targeting remote URL just replace the app with your remote server URL
request('http://yourserverhere.com')
.get('/api/photo/' + photo._id)
.set(apiKeyName, apiKey)
.end(function(err, res) {
if (err) throw err;
if (res.body._id !== photo._id) throw Error('No _id found');
done();
});
Problem
I'm using MochaJS and SuperTest to test my API during development and absolutely LOVE it. However, I would like to also turn these same tests to remotely tests my staging server before pushing the code out to production. Is there a way to supply request with a remote URL or proxy to a remote URL? Here is a sample of a test I use ``` request(app) .get('/api/photo/' + photo._id) .set(apiKeyName, apiKey) .end(function(err, res) { if (err) throw err; if (res.body._id !== photo._id) throw Error('No _id found'); done(); }); ```