mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-25 13:51:00 +00:00
Added browser skeleton
This commit is contained in:
parent
07e127eef1
commit
67e24897d1
3 changed files with 64 additions and 0 deletions
|
@ -28,6 +28,15 @@ module.exports = app => {
|
|||
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) => {
|
||||
response.status(404).render("404.hbs");
|
||||
});
|
||||
|
|
40
spec/messages.integration.js
Normal file
40
spec/messages.integration.js
Normal 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
15
views/messages.hbs
Normal 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>
|
Loading…
Reference in a new issue