Feature: Master Page
As a vision user I want the vision application served as a single page So that I can spend less time waiting for page loads
Let's add a test to ./test/home.js
for our feature Master Page
. This resource will GET
our master page from route ./
and return a 200 OK
response. The Content-Type
of the response should be HTML:
var app = require('../app') , request = require('supertest'); describe('vision master page', function(){ describe('when requesting resource /', function(){ it('should respond with view', function(done){ request(app) .get('/') .expect('Content-Type', /html/) .expect(200, done) }); }); });
Let's implement our Master Page
feature. Let's create a new module that exposes a route ./lib/routes/home.js
and add a new index
function. We start by defining a route called index
. We create a view model
with meta information for a page and then render the view passing the view model
:
exports.index = function(req, res){ var...