From 8e7091e63ea18f736cb77f25b10865e70f60d724 Mon Sep 17 00:00:00 2001 From: Kashav Madan Date: Sat, 30 Apr 2016 01:01:38 -0400 Subject: [PATCH] Add tests --- test/exams/test.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/test/exams/test.js b/test/exams/test.js index 7b9e953..a78945c 100644 --- a/test/exams/test.js +++ b/test/exams/test.js @@ -313,9 +313,22 @@ test.cb('/filter?q=date:"2016-04-28"', t => { }) }) -test.cb('/filter?q=date:>"2016-04-30"', t => { +test.cb('/filter?q=date:>=1461988800', t => { request(cobalt.Server) - .get('/1.0/exams/filter?q=date:%3E%222016-04-30%22') + .get('/1.0/exams/filter?q=date:%3E=1461988800') + .expect('Content-Type', /json/) + .expect(200) + .expect(testData.slice(0, 10)) + .end((err, res) => { + if (err) t.fail(err.message) + t.pass() + t.end() + }) +}) + +test.cb('/filter?q=date:<="2016,04,30"', t => { + request(cobalt.Server) + .get('/1.0/exams/filter?q=date:%3E=%222016,04,30%22') .expect('Content-Type', /json/) .expect(200) .expect('[]') @@ -352,6 +365,19 @@ test.cb('/filter?q=duration:<=10800', t => { }) }) +test.cb('/filter?q=duration:-7200', t => { + request(cobalt.Server) + .get('/1.0/exams/filter?q=duration:-7200') + .expect('Content-Type', /json/) + .expect(200) + .expect(testData.filter(doc => doc.duration !== 7200).slice(0, 10)) + .end((err, res) => { + if (err) t.fail(err.message) + t.pass() + t.end() + }) +}) + test.cb('/filter?q=location:"HI CART"', t => { request(cobalt.Server) .get('/1.0/exams/filter?q=location:%22HI%20CART%22')