aboutsummaryrefslogtreecommitdiff
path: root/test/test.js
diff options
context:
space:
mode:
authorHumairAK <humair88@hotmail.com>2016-07-26 20:53:35 +0000
committerHumairAK <humair88@hotmail.com>2016-07-26 20:53:35 +0000
commitfa98fa652f41a7c87fe76ab57448ab702e06c82c (patch)
tree81a8d0d4bfe24ebfcc92ebca16e83e811e6c86bd /test/test.js
parent9c10936cf1420f160a5007c6baad7b25ffb6d014 (diff)
more unit tests
Diffstat (limited to 'test/test.js')
-rw-r--r--test/test.js20
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();
+ });
+ });
+
});