Skip to content

Instantly share code, notes, and snippets.

@brianflurry
brianflurry / mocha_console
Created October 2, 2012 17:58
running mocha
>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
@brianflurry
brianflurry / start_server.js
Created October 2, 2012 17:49
Start Server
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();
@brianflurry
brianflurry / service_hello_tests.js
Created October 2, 2012 17:47
Hello World Mocha regression test
// 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() {
@brianflurry
brianflurry / 01-start-server.js
Created October 2, 2012 17:44
Startup the Node server before running regression tests
restify = require('restify');
assert = require('assert');
before(function(done) {
require('../start_server').StartServer();
done();
});
@brianflurry
brianflurry / app.js
Created October 2, 2012 17:43
app.js contents
var start = require('./start_server');
start.StartServer();
@brianflurry
brianflurry / npm_install
Created October 2, 2012 17:42
Installing Restify and Mocha
sudo npm install restify
sudo npm install mocha