From 409f3f3e7e1f4947c49e66f78f3e7bb7362e4949 Mon Sep 17 00:00:00 2001 From: Dave Lester Date: Sat, 13 Apr 2013 13:24:13 -0700 Subject: [PATCH] Fixes tests for backpack controller. --- test/backpack-controller.test.js | 96 +++++++------------------------- 1 file changed, 21 insertions(+), 75 deletions(-) diff --git a/test/backpack-controller.test.js b/test/backpack-controller.test.js index 91de6a8a..b3f5aa1a 100644 --- a/test/backpack-controller.test.js +++ b/test/backpack-controller.test.js @@ -81,32 +81,14 @@ $.prepareDatabase({ }) }); }); -}); -test('backpack#facebookSharing', function (t) { - conmock({ - handler: backpack.facebookSharing, - request: { - body: { - accessToken: 'aaBBccDDeFgHiJkLMnOP', - badgeBodyHash: 'sillybadgehash', - userId: 'me', - comment: 'Commenting on my badge so others know how awesome I am!', - facebookAutomaticPush: 'checked' - } - } - }, function (err, mock, req) { - if (err) throw err; - t.equal(mock.status, 303); - t.end(); - }); -}); test('backpack#manage', function (t) { // #TODO: re-write after making backpack.manage sane. t.end(); }); + test('backpack#settings redirects to login if no user', function (t) { conmock({handler: backpack.settings()}, function(err, mock) { t.same(mock.status, 303); @@ -164,62 +146,26 @@ test('backpack#facebookSharing', function (t) { }); t.end(); }); - }); -}); -test('backpack#facebookSharing', function (t) { - conmock({ - handler: backpack.facebookSharing, - request: { - body: { - accessToken: 'aaBBccDDeFgHiJkLMnOP', - badgeBodyHash: 'sillybadgehash', - userId: 'me', - comment: 'Commenting on my badge so others know how awesome I am!', - facebookAutomaticPush: 'checked' - } - } - }, function (err, mock, req) { - if (err) throw err; - t.equal(mock.status, 303); - t.end(); - }); -}); - -test('backpack#facebookSharing', function (t) { - conmock({ - handler: backpack.facebookSharing, - request: { - body: { - accessToken: 'aaBBccDDeFgHiJkLMnOP', - badgeBodyHash: 'sillybadgehash', - userId: 'me', - comment: 'Commenting on my badge so others know how awesome I am!', - facebookAutomaticPush: 'checked' - } - } - }, function (err, mock, req) { - if (err) throw err; - t.equal(mock.status, 303); - t.end(); - }); -}); + $.finish(test); + }); -test('backpack#facebookSharing', function (t) { - conmock({ - handler: backpack.facebookSharing, - request: { - body: { - accessToken: 'aaBBccDDeFgHiJkLMnOP', - badgeBodyHash: 'sillybadgehash', - userId: 'me', - comment: 'Commenting on my badge so others know how awesome I am!', - fbAutomaticPush: 'checked' - } - } - }, function (err, mock, req) { - if (err) throw err; - t.equal(mock.status, 303); - t.end(); + test('backpack#facebookSharing', function (t) { + conmock({ + handler: backpack.facebookSharing, + request: { + body: { + accessToken: 'aaBBccDDeFgHiJkLMnOP', + badgeBodyHash: 'sillybadgehash', + userId: 'me', + comment: 'Commenting on my badge so others know how awesome I am!', + facebookAutomaticPush: 'checked' + } + } + }, function (err, mock, req) { + if (err) throw err; + t.equal(mock.status, 303); + t.end(); + }); }); -}); +}); \ No newline at end of file