Skip to content

Commit

Permalink
Convert backpack controller test
Browse files Browse the repository at this point in the history
  • Loading branch information
brianloveswords committed Nov 16, 2012
1 parent 5ef50b0 commit c0cb989
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 104 deletions.
104 changes: 0 additions & 104 deletions test/backpack-controller-test.js

This file was deleted.

39 changes: 39 additions & 0 deletions test/backpack-controller.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const _ = require('underscore');
const test = require('tap').test;
const testUtils = require('./');
const backpack = require('../controllers/backpack');
const conmock = require('./conmock');

test('backpack#login', function (t) {
conmock({
handler: backpack.login,
request: {
session: { _csrf: 'cats' }
}
}, function (err, mock) {
t.same(mock.fntype, 'render', 'should try to render the login page');
t.same(mock.options['csrfToken'], 'cats', 'should have right csrf token');
t.end();
});
});

test('backpack#signout', function (t) {
conmock({
handler: backpack.signout,
request: {
session: { email: '[email protected]' }
}
}, function (err, mock, req) {
t.same(mock.path, '/backpack/login', 'should redirect to the login page');
t.same(_.keys(req.session).length, 0, 'should wipe out the session');
t.end();
});
});

test('backpack#manage', function (t) {
// #TODO: re-write after making backpack.manage sane.
t.end();
});


testUtils.finish(test);

0 comments on commit c0cb989

Please sign in to comment.