Added browser skeleton

This commit is contained in:
Chris Blanchard 2015-12-27 19:42:32 +00:00
parent 07e127eef1
commit 67e24897d1
3 changed files with 64 additions and 0 deletions

View file

@ -28,6 +28,15 @@ module.exports = app => {
response.status(200).json(gather.toJson()); response.status(200).json(gather.toJson());
}); });
app.get("/messages", (request, response) => {
if (request.is("json")) {
// To Implement
response.end("")
} else {
response.render("messages.hbs");
}
});
app.get("*", (request, response) => { app.get("*", (request, response) => {
response.status(404).render("404.hbs"); response.status(404).render("404.hbs");
}); });

View file

@ -0,0 +1,40 @@
"use strict";
var helper = require("./helpers/index.js");
var request = require("supertest");
var assert = require("chai").assert;
var app = helper.app;
describe("Messages", () => {
beforeEach(done => {
done();
});
afterEach(done => {
done();
});
describe("#Index", () => {
describe("JSON Api", () => {
it ("returns most recent messages");
it ("is sensitive to limit");
it ("returns a maximum of last 250 messages");
it ("is sensitive to pagination");
it ("is sensitive to user");
it ("is sensitive to search terms");
});
describe("HTML Browser", () => {
it ("renders message browser", done => {
request(app)
.get("/messages")
.set("Accept", "text/html; charset=utf-8")
.expect('Content-Type', /html/)
.expect(200)
.end((error, response) => {
if (error) return done(error);
assert.include(response.text, "Message Browser");
done();
});
})
});
});
});

15
views/messages.hbs Normal file
View file

@ -0,0 +1,15 @@
<div id="wrapper">
{{>menu}}
<div style="min-height: 750px;">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h2>Message Browser</h2>
</div>
<div class="col-lg-12">
</div>
</div>
</div>
</div>
</div>