From f660d4b3b86da4b199e0311fa8fa934ae904ad41 Mon Sep 17 00:00:00 2001 From: Mark Wilson Date: Tue, 10 Jul 2018 18:54:20 -0700 Subject: [PATCH] Fix test failing because of bad time offset (#8) --- test/transform.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/transform.js b/test/transform.js index 80faab9..ff4961f 100644 --- a/test/transform.js +++ b/test/transform.js @@ -30,18 +30,27 @@ describe('transform()', function() { }); it('should discard data more than 20 minutes old', function() { - var now = Date.now(); + var pumpTimeString = 'Oct 17, 2015 09:06:33'; + var now = Date.parse('Oct 17, 2015 09:09:14'); var THRESHOLD = 20; var boundary = now - THRESHOLD * 60 * 1000; expect( transform( - f.data({'currentServerTime': now, 'lastMedicalDeviceDataUpdateServerTime': boundary}) + f.data({ + 'sMedicalDeviceTime': pumpTimeString, + 'currentServerTime': now, + 'lastMedicalDeviceDataUpdateServerTime': boundary, + }) ).entries.length ).to.be.greaterThan(0); expect( transform( - f.data({'currentServerTime': now, 'lastMedicalDeviceDataUpdateServerTime': boundary - 1}) + f.data({ + 'sMedicalDeviceTime': pumpTimeString, + 'currentServerTime': now, + 'lastMedicalDeviceDataUpdateServerTime': boundary - 1, + }) ).entries.length ).to.be(0); });