You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
886 B
45 lines
886 B
var assert = require('assert');
|
|
var app = require('./service/app');
|
|
var util = require('utils-extend');
|
|
var request = require('../index');
|
|
var server;
|
|
|
|
describe('Http post', function() {
|
|
// Start service
|
|
beforeEach(function(done){
|
|
server = app.listen(3100, function() {
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('Request post', function(done) {
|
|
request({
|
|
url: 'http://127.0.0.1:3100/save',
|
|
method: 'POST',
|
|
data: {
|
|
id: 1
|
|
},
|
|
json: true
|
|
}, function(err, res, body) {
|
|
assert.deepEqual(body, { id: 1});
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('Post method', function(done) {
|
|
request.post({
|
|
url: 'http://127.0.0.1:3100/save',
|
|
data: {
|
|
id: 1
|
|
},
|
|
json: true
|
|
}, function(err, res, body) {
|
|
assert.deepEqual(body, { id: 1});
|
|
done();
|
|
});
|
|
});
|
|
|
|
afterEach(function(){
|
|
server.close();
|
|
});
|
|
}); |