This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>mocha -R tap | |
1..1 | |
restify listening at http://0.0.0.0:8080 | |
ok 1 service: hello 200 response check should get a 200 response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.StartServer = function() { | |
var restify = require('restify'); | |
function respond(req, res, next) { | |
res.contentType = 'application/json'; | |
res.send({ code: 200, message: 'hello ' + req.params.name }); | |
res.end(); | |
} | |
var server = restify.createServer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// init the test client | |
var client = restify.createJsonClient({ | |
version: '*', | |
url: 'http://127.0.0.1:8080' | |
}); | |
describe('service: hello', function() { | |
// Test #1 | |
describe('200 response check', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
restify = require('restify'); | |
assert = require('assert'); | |
before(function(done) { | |
require('../start_server').StartServer(); | |
done(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var start = require('./start_server'); | |
start.StartServer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo npm install restify | |
sudo npm install mocha |