This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
tstatic/tests/server.test.js
2017-01-19 17:31:23 +00:00

42 lines
862 B
JavaScript

const request = require('supertest');
const fs = require('fs');
describe('Server', function () {
var server;
before(function () {
server = require('../src/server');
});
after(function () {
server.close();
});
it('responds to /', function (done) {
request(server)
.get('/')
.expect(200, done);
});
it('returns 404 on bad path', function (done) {
request(server)
.get('/foo/bar')
.expect(404, done);
});
describe('index route', function () {
const body = fs.readFileSync(__dirname + '/../site/index.html').toString();
it('should render /index.html', function (done) {
request(server)
.get('/index.html')
.expect(200, body, done);
});
it('should render /', function (done) {
request(server)
.get('/')
.expect(200, body, done);
});
});
});