mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Add tests for helper functions
This commit is contained in:
parent
cd06abff97
commit
84450479ae
3 changed files with 26 additions and 12 deletions
17
test/cljs/airsonic_ui/test_helpers_test.cljs
Normal file
17
test/cljs/airsonic_ui/test_helpers_test.cljs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(ns airsonic-ui.test-helpers-test
|
||||
(:require [cljs.test :refer [deftest testing is]]
|
||||
[airsonic-ui.test-helpers :refer [dispatches?]]))
|
||||
|
||||
(deftest dispatch-helper
|
||||
(testing "single dispatch"
|
||||
(is (not (dispatches? {} :foo)))
|
||||
(is (dispatches? {:dispatch [:foo 1 2 3]} :foo))
|
||||
(is (not (dispatches? {:dispatch [:foo 1 2 3]} :bar)))
|
||||
(is (dispatches? {:dispatch [:foo 1 2 3]} [:foo 1 2 3]))
|
||||
(is (not (dispatches? {:dispatch [:foo 1 2 3]} [:bar 2 3]))))
|
||||
(testing "multiple dispatch"
|
||||
(is (not (dispatches? {:dispatch-n [[:bar]]} :foo)))
|
||||
(is (dispatches? {:dispatch-n [[:foo 1 2 3]]} :foo))
|
||||
(is (not (dispatches? {:dispatch-n [[:foo 1 2 3]]} :bar)))
|
||||
(is (dispatches? {:dispatch-n [[:foo 1 2 3]]} [:foo 1 2 3]))
|
||||
(is (not (dispatches? {:dispatch-n [[:foo 1 2 3]]} [:bar 2 3])))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue