From 9f20183cb1cdc8a7ef8735e3717da979d59e249f Mon Sep 17 00:00:00 2001 From: Nikita Prokopov Date: Mon, 20 Jul 2015 02:09:41 +0600 Subject: [PATCH] trying more reliable test-uuid test --- test/datascript/test/core.cljc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/datascript/test/core.cljc b/test/datascript/test/core.cljc index 9fcd6986..2c759a5c 100644 --- a/test/datascript/test/core.cljc +++ b/test/datascript/test/core.cljc @@ -94,10 +94,11 @@ :cljs (.getTime (js/Date.)))) (deftest test-uuid - (loop [] - (when (> (mod (now) 1000) 990) ;; sleeping over end of a second - (recur))) - (let [now-ms (now) + (let [now-ms (loop [] + (let [ts (now)] + (if (> (mod ts 1000) 900) ;; sleeping over end of a second + (recur) + ts))) now (int (/ now-ms 1000))] (is (= (* 1000 now) (d/squuid-time-millis (d/squuid)))) (is (not= (d/squuid) (d/squuid)))