Skip to content

Commit

Permalink
trying more reliable test-uuid test
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed Jul 19, 2015
1 parent 8020986 commit 9f20183
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/datascript/test/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 9f20183

Please sign in to comment.