with supertest, I can make a resquest to test my node.js application
var request = require('supertest');
var api = require('../server').app;
...
it('json response', function(done){
request(api)
.get('/api')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.end(function(err, res){
done();
});
});
how I can set a specific ip to make the test request ?
it('ip access denied', function(done){
request(api)
.get('/api')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
// set specific ip
.end(function(err, res){
res.body.message.should.eql('Access denied');
done();
});
});