From 8577be77e6ead88e7d9baf86f026fac4aeea4049 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Sun, 2 Aug 2015 21:34:47 -0400 Subject: start some tests for the server --- test/server.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/server.js (limited to 'test') diff --git a/test/server.js b/test/server.js new file mode 100644 index 0000000..a003b50 --- /dev/null +++ b/test/server.js @@ -0,0 +1,39 @@ +var should = require('should'); +var request = require('request'); +var server = require('../src'); + +var ROOT_URL = 'http://127.0.0.1:8000'; + +describe('Server', function() { + + before(function() { + server.start(); + }); + + after(function() { + server.stop(); + }); + + describe('Basic Connectivity', function() { + it('should be available on port 8000', function() { + request.get(ROOT_URL, function(err, response, body) { + response.should.be.html(); + }); + }); + + it('should serve the index', function() { + request.get(ROOT_URL, function(err, response, body) { + body.should.not.be.empty(); + }); + }) + }); + + describe('Search results', function() { + it('should display search results', function() { + request.get(ROOT_URL + '/search?q=do+re+mi', function(err, res, body) { + body.should.not.be.empty(); + response.should.have.status(200); + }); + }); + }); +}); -- cgit v1.2.3