Skip to content

Commit 60f3b96

Browse files
committed
Update test to doo and cljs.test
1 parent 33f3119 commit 60f3b96

File tree

4 files changed

+36
-28
lines changed

4 files changed

+36
-28
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ pom.xml.asc
77
*.class
88
/.lein-*
99
/.nrepl-port
10+
/out

project.clj

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[org.clojure/clojurescript "1.9.494" :scope "provided"]]
99

1010
:aliases {"deploy" ["do" "clean," "deploy" "clojars"]
11-
"test" ["do" "clean," "with-profile" "dev" "cljsbuild" "test"]}
11+
"test" ["do" "clean," "doo" "phantom" "test" "once"]}
1212

1313
:lein-release {:deploy-via :shell
1414
:shell ["lein" "deploy"]}
@@ -18,9 +18,9 @@
1818

1919
:source-paths ["src"]
2020

21-
:profiles {:dev {:dependencies [[secretary "1.2.1"]]
22-
:plugins [[lein-cljsbuild "1.1.5"]
23-
[com.cemerick/clojurescript.test "0.3.3"]]
21+
:profiles {:dev {:dependencies [[secretary "1.2.3"]]
22+
:plugins [[lein-cljsbuild "1.1.7"]
23+
[lein-doo "0.1.10"]]
2424

2525
:cljsbuild
2626
{:test-commands
@@ -29,5 +29,6 @@
2929
:builds
3030
{:test {:source-paths ["src" "test"]
3131
:compiler {:output-to "target/unit-test.js"
32+
:main pushy.test.runner
3233
:optimizations :whitespace
3334
:pretty-print true}}}}}})

test/pushy/test/core.cljs

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
(ns pushy.test.core
2-
(:require-macros
3-
[cemerick.cljs.test :refer (is deftest done use-fixtures)])
42
(:require
3+
[clojure.test :refer [deftest is async] :as test]
54
[pushy.core :as pushy]
65
[secretary.core :as secretary :refer-macros [defroute]]
7-
[goog.events :as events]
8-
[cemerick.cljs.test :as t])
6+
[goog.events :as events])
97
(:import goog.history.Html5History))
108

119
(secretary/set-config! :prefix "/")
@@ -32,25 +30,27 @@
3230
(is (pushy/supported?)))
3331

3432
;; 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)))
4645

4746
;; 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)))

test/pushy/test/runner.cljs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(ns pushy.test.runner
2+
(:require [doo.runner :refer-macros [doo-tests]]
3+
[pushy.test.core]))
4+
5+
6+
(doo-tests 'pushy.test.core)

0 commit comments

Comments
 (0)