You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ni...@apache.org on 2016/05/05 20:12:10 UTC

cordova-plugin-device-motion git commit: CB-11188: cordova-plugin-device-motion-tests are failing in CI

Repository: cordova-plugin-device-motion
Updated Branches:
  refs/heads/master ab56547d3 -> 7a6259db3


CB-11188: cordova-plugin-device-motion-tests are failing in CI

 This closes #43


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/7a6259db
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/7a6259db
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/7a6259db

Branch: refs/heads/master
Commit: 7a6259db32c7d3cbfc9f78d193bba07fdcffc78a
Parents: ab56547
Author: Sarangan Rajamanickam <sa...@microsoft.com>
Authored: Thu May 5 11:11:05 2016 -0700
Committer: Nikhil Khandelwal <ni...@microsoft.com>
Committed: Thu May 5 13:11:54 2016 -0700

----------------------------------------------------------------------
 tests/tests.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/7a6259db/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 73587e7..b782629 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -24,8 +24,8 @@
 
 exports.defineAutoTests = function () {
     var isWindows = (cordova.platformId === "windows") || (cordova.platformId === "windows8"),
-     // Checking existence of accelerometer for windows platform 
-     // Assumed that accelerometer always exists on other platforms. Extend 
+     // Checking existence of accelerometer for windows platform
+     // Assumed that accelerometer always exists on other platforms. Extend
      // condition to support accelerometer check on other platforms
      isAccelExist = isWindows ? Windows.Devices.Sensors.Accelerometer.getDefault() !== null : true;
 
@@ -178,11 +178,15 @@ exports.defineAutoTests = function () {
             pending();
           }
           var veryRecently = (new Date()).getTime();
+          var ACCEPTABLE_PERCENT_RANGE = 95;
           // Need to check that dates returned are not vastly greater than a recent time stamp.
           // In case the timestamps returned are ridiculously high
           var reasonableTimeLimit = veryRecently + 5000; // 5 seconds from now
           var win = function(a) {
-            expect(a.timestamp).toBeGreaterThan(veryRecently);
+            // Checking if the returned timestamp is atleast 95% of the veryRecently timestamp
+            // If it is greater than very recently (for eg: 125%) it is fine and we do not want
+            // a positive delta comparison in this assert
+            expect((a.timestamp * 100) / veryRecently).toBeGreaterThan(ACCEPTABLE_PERCENT_RANGE);
             expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
             done();
           };


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org