Permalink
Browse files

Tests work in phantom but not nashorn. Adding circle build

  • Loading branch information...
1 parent 54399a0 commit 31e80446dce39a489223b59be4912941b5eb1590 @oliyh committed Dec 24, 2016
Showing with 49 additions and 3 deletions.
  1. +8 −0 circle.yml
  2. +2 −2 project.clj
  3. +1 −1 src/re_learn/model.cljs
  4. +4 −0 test/re_learn/all_tests.cljs
  5. +34 −0 test/re_learn/model_test.cljs
View
@@ -0,0 +1,8 @@
+machine:
+ java:
+ version:
+ oraclejdk8
+
+test:
+ override:
+ - lein test
View
@@ -27,7 +27,7 @@
[alandipert/storage-atom "1.2.4"]]
:repl-options {:init-ns user
:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}
- :aliases {"test" ["do" ["clean"] ["test"] ["doo" "nashorn" "test" "once"]]}
+ :aliases {"test" ["do" ["clean"] ["test"] ["doo" "phantom" "test" "once"]]}
:figwheel {:css-dirs ["dev-resources/public/css"]}
:cljsbuild {:builds [{:id "checkout"
:source-paths ["src/" "example/checkout"]
@@ -64,4 +64,4 @@
:compiler {:output-to "out/unit-test.js"
:main "re-learn.runner"
:optimizations :whitespace
- :parallel-build false}}]})
+ :parallel-build true}}]})
@@ -15,7 +15,7 @@
(def ^:private interceptors
[(re-frame/path state)
- re-frame/debug
+ ;;re-frame/debug
re-frame/trim-v
(re-frame/after validate-schema)])
@@ -0,0 +1,4 @@
+(ns re-learn.all-tests
+ (:require [re-learn.devcards.lessons]
+ [re-learn.devcards.context]
+ [re-learn.model-test]))
@@ -0,0 +1,34 @@
+(ns re-learn.model-test
+ (:require [re-learn.model :as model]
+ [re-frame.core :as re-frame]
+ [day8.re-frame.test :refer-macros [run-test-sync]]
+ [cljs.test :refer-macros [deftest is testing run-tests]]
+ [devcards.core :refer-macros [deftest]]))
+
+(def ^:private a-lesson
+ {:id :a-lesson
+ :description "A test lesson"})
+
+(deftest tutorial-precedence-test
+ (run-test-sync
+ (re-frame/dispatch [::model/init])
+ (let [tutorial (re-frame/subscribe [::model/current-tutorial])]
+
+ (testing "there are no tutorials at first"
+ (is (= nil @tutorial)))
+
+ (testing "a registered tutorial appears first"
+ (re-frame/dispatch [::model/register-tutorial {:id :less-important
+ :name "Less important things"
+ :description "Learn about less important things"
+ :lessons [a-lesson]
+ :precedence 2}])
+ (is (= :less-important (get-in @tutorial [:tutorial :id]))))
+
+ (testing "a more important tutorial can take a higher precedence"
+ (re-frame/dispatch [::model/register-tutorial {:id :important
+ :name "Important tutorial!"
+ :description "Learn about very important things"
+ :lessons [a-lesson]
+ :precedence 1}])
+ (is (= :important (get-in @tutorial [:tutorial :id])))))))

0 comments on commit 31e8044

Please sign in to comment.