2015-07-20 09:41:58 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var helper = require("./helpers/index.js");
|
|
|
|
var request = require("supertest");
|
2015-09-17 12:48:10 +00:00
|
|
|
var assert = require("chai").assert;
|
2015-07-20 09:41:58 +00:00
|
|
|
var app = helper.app;
|
|
|
|
|
2015-09-17 12:48:10 +00:00
|
|
|
describe("Basic Spec", () => {
|
|
|
|
it ("serves main page", done => {
|
2015-07-20 09:41:58 +00:00
|
|
|
request(app)
|
|
|
|
.get("/")
|
2015-08-18 11:40:48 +00:00
|
|
|
.expect(200)
|
2015-07-20 09:41:58 +00:00
|
|
|
.end(done);
|
|
|
|
});
|
|
|
|
|
2015-09-17 12:48:10 +00:00
|
|
|
it ("returns 404 if page not found", done => {
|
2015-07-20 09:41:58 +00:00
|
|
|
request(app)
|
|
|
|
.get("/foo")
|
|
|
|
.expect(404)
|
|
|
|
.end(done);
|
|
|
|
});
|
2015-09-17 12:48:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe("Gathers API", () => {
|
|
|
|
describe("gathers/current", () => {
|
|
|
|
it ("returns the current gather", done => {
|
|
|
|
request(app)
|
|
|
|
.get("/gathers/current")
|
|
|
|
.expect(200)
|
|
|
|
.end((error, response) => {
|
|
|
|
if (error) return done(error);
|
|
|
|
assert.equal(response.body.gatherers.length, 0);
|
|
|
|
assert.equal(response.body.state, 'gathering');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2015-07-20 09:41:58 +00:00
|
|
|
});
|