From ec7575f4dc3c52c7a5bb8b5f482f6a3664abfd2d Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Tue, 12 Jan 2016 18:17:30 -0500 Subject: Add support for alert_days and alert_minutes parameters --- tests/active911.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/active911.js b/tests/active911.js index 0aa9ffa..de91f1c 100644 --- a/tests/active911.js +++ b/tests/active911.js @@ -17,7 +17,7 @@ var resourceResponse = require('./replies/resource.json'); var errorResponse = require('./replies/error.json'); var nockPath = function(path, response) { - nock('https://access.active911.com') + return nock('https://access.active911.com') .get('/interface/open_api/api' + path) .reply(200, response); }; @@ -136,3 +136,26 @@ describe('Active911 API', function() { }); }); }); + +describe('Alert filtering', function() { + it('should request alerts filtered by alert_days', function(done) { + var n = nockPath('/alerts?alert_days=1', alertsResponse); + client.getAlerts({ alert_days: 1}).then(function() { + n.isDone().should.be.true; + done(); + }).catch(function(err) { + false.should.be.true; + done(); + }); + }); + it('should request alerts filtered by alert_minutes', function(done) { + var n = nockPath('/alerts?alert_minutes=1', alertsResponse); + client.getAlerts({ alert_minutes: 1}).then(function() { + n.isDone().should.be.true; + done(); + }).catch(function(err) { + false.should.be.true; + done(); + }); + }); +}); -- cgit v1.2.3