[Pkg-mozext-commits] [perspectives-extension] 16/44: Unit tests - Fix test data

David Prévot taffit at moszumanska.debian.org
Sat Jun 6 02:55:27 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository perspectives-extension.

commit 6268ae21da6825e830fe5151733712d04148584e
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date:   Mon Nov 3 21:15:46 2014 -0700

    Unit tests - Fix test data
    
    Start and end dates were swapped.
    Add asserts to make sure this can't happen.
---
 test/test.html | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/test/test.html b/test/test.html
index d209b54..665840e 100644
--- a/test/test.html
+++ b/test/test.html
@@ -219,12 +219,13 @@ function client_sanity() {
     var key = "b1:7f:b1:15:25:4e:7b:fb:93:83:ac:5c:26:df:f7:00";
     var curtime = Pers_util.get_unix_time();
     var short_start = curtime - 1;
+    var short_end = curtime;
     var short_result_list = [
         { "server": "test1:8080",
             "obs": [
                 { "key": key,
                     "timestamps": [
-                        { "start": short_start, "end": curtime  }
+                        { "start": short_start, "end": short_end  }
                     ] }
             ]
         }
@@ -232,8 +233,8 @@ function client_sanity() {
 
     var days_last_seen = 3;
     var duration       = 2; // days
-    var old_end   = Pers_util.get_unix_time() - Pers_util.DAY2SEC(days_last_seen           );
-    var old_start = Pers_util.get_unix_time() - Pers_util.DAY2SEC(days_last_seen - duration);
+    var old_start = Pers_util.get_unix_time() - Pers_util.DAY2SEC(days_last_seen);
+    var old_end = Pers_util.get_unix_time() - Pers_util.DAY2SEC(days_last_seen - duration);
 
     var second_result_list = [
         { "server": "test1:8080",
@@ -254,6 +255,8 @@ function client_sanity() {
         }
     ];
 
+    assert(short_start <= short_end, "(meta) Short keys start before they end.");
+    assert(old_start <= old_end, "(meta) Old keys start before they end.");
     var weakly_seen0 = Pers_client_policy.key_weakly_seen_by_quorum(key, short_result_list, 1, -10);
     assert(weakly_seen0 === false, "Negative Check lengths can't be weakly seen");
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git



More information about the Pkg-mozext-commits mailing list