diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/test.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/test/test.js b/test/test.js index 3b23916..dd47d48 100644 --- a/test/test.js +++ b/test/test.js @@ -207,7 +207,6 @@ describe('Search Route:', function(){ }); - /* Questions Listing route for a particular exam */ describe('Questions Search Route:', function(){ var server; @@ -230,7 +229,7 @@ describe('Questions Search Route:', function(){ }); }); - it.only('Search questions for a non existing exam', function testSlash(done) { + it('Search questions for a non existing exam', function testSlash(done) { var examID = exams.nonExisting._id.$oid; chai.request(server) .get('/questions/' + examID) @@ -244,6 +243,23 @@ describe('Questions Search Route:', function(){ }); }); + /* This differs from the earlier test because it will throw an error in db + * query and not return an exam at all, whereas before we pass in a + * legitimate hashed format id. Here we pass just random letters. + */ + it.only('Search questions for gibberish id', function testSlash(done) { + chai.request(server) + .get('/questions/batman') + .end(function(err, res){ + expect(res).to.have.status(200); + var path = res.res.req.path; + + // Redirected to homepage (with err msg) + assert.equal(path, '/'); + done(); + }); + }); + }); |
