aboutsummaryrefslogtreecommitdiff
path: root/test/server.js
blob: a003b500e5bd7aec58e47a3c79a559fad0173af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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);
      });
    });
  });
});