|
1 | 1 | (ns pushy.test.core
|
2 |
| - (:require-macros |
3 |
| - [cemerick.cljs.test :refer (is deftest done use-fixtures)]) |
4 | 2 | (:require
|
| 3 | + [clojure.test :refer [deftest is async] :as test] |
5 | 4 | [pushy.core :as pushy]
|
6 | 5 | [secretary.core :as secretary :refer-macros [defroute]]
|
7 |
| - [goog.events :as events] |
8 |
| - [cemerick.cljs.test :as t]) |
| 6 | + [goog.events :as events]) |
9 | 7 | (:import goog.history.Html5History))
|
10 | 8 |
|
11 | 9 | (secretary/set-config! :prefix "/")
|
|
32 | 30 | (is (pushy/supported?)))
|
33 | 31 |
|
34 | 32 | ;; event listeners started = dispatch
|
35 |
| -(deftest ^:async push-state-foo-route |
36 |
| - (reset! test-val false) |
37 |
| - (pushy/start! history) |
38 |
| - (pushy/replace-token! history "/foo") |
39 |
| - (js/setTimeout |
40 |
| - (fn [] |
41 |
| - (is @test-val) |
42 |
| - (is (nil? (pushy/stop! history))) |
43 |
| - (is (= "/foo" (pushy/get-token history))) |
44 |
| - (done)) |
45 |
| - 5000)) |
| 33 | +(deftest push-state-foo-route |
| 34 | + (async done |
| 35 | + (reset! test-val false) |
| 36 | + (pushy/start! history) |
| 37 | + (pushy/replace-token! history "/foo") |
| 38 | + (js/setTimeout |
| 39 | + (fn [] |
| 40 | + (is @test-val) |
| 41 | + (is (nil? (pushy/stop! history))) |
| 42 | + (is (= "/foo" (pushy/get-token history))) |
| 43 | + (done)) |
| 44 | + 5000))) |
46 | 45 |
|
47 | 46 | ;; no event listeners started = no dispatch
|
48 |
| -(deftest ^:async push-state-bar-route |
49 |
| - (reset! test-val false) |
50 |
| - (pushy/replace-token! history "/bar") |
51 |
| - (js/setTimeout |
52 |
| - (fn [] |
53 |
| - (is (false? @test-val)) |
54 |
| - (is (= "/bar" (pushy/get-token history))) |
55 |
| - (done)) |
56 |
| - 5000)) |
| 47 | +(deftest push-state-bar-route |
| 48 | + (async done |
| 49 | + (reset! test-val false) |
| 50 | + (pushy/replace-token! history "/bar") |
| 51 | + (js/setTimeout |
| 52 | + (fn [] |
| 53 | + (is (false? @test-val)) |
| 54 | + (is (= "/bar" (pushy/get-token history))) |
| 55 | + (done)) |
| 56 | + 5000))) |
0 commit comments