mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Start restructuring audio playback, add some tests for audio
Fixes #15 where audio was not stopped on logout
This commit is contained in:
parent
727d454871
commit
80225d46b1
10 changed files with 187 additions and 69 deletions
|
|
@ -1,17 +1,24 @@
|
|||
(ns airsonic-ui.test-helpers-test
|
||||
(:require [cljs.test :refer [deftest testing is]]
|
||||
[airsonic-ui.test-helpers :refer [dispatches?]]))
|
||||
[airsonic-ui.test-helpers :as h]))
|
||||
|
||||
(deftest dispatch-helper
|
||||
(testing "single dispatch"
|
||||
(is (false? (dispatches? {} :foo)))
|
||||
(is (true? (dispatches? {:dispatch [:foo 1 2 3]} :foo)))
|
||||
(is (false? (dispatches? {:dispatch [:foo 1 2 3]} :bar)))
|
||||
(is (true? (dispatches? {:dispatch [:foo 1 2 3]} [:foo 1 2 3])))
|
||||
(is (false? (dispatches? {:dispatch [:foo 1 2 3]} [:bar 2 3]))))
|
||||
(testing "multiple dispatch"
|
||||
(is (false? (dispatches? {:dispatch-n [[:bar]]} :foo)))
|
||||
(is (true? (dispatches? {:dispatch-n [[:foo 1 2 3]]} :foo)))
|
||||
(is (false? (dispatches? {:dispatch-n [[:foo 1 2 3]]} :bar)))
|
||||
(is (dispatches? {:dispatch-n [[:foo 1 2 3]]} [:foo 1 2 3]))
|
||||
(is (false? (dispatches? {:dispatch-n [[:foo 1 2 3]]} [:bar 2 3])))))
|
||||
(testing "Should identify singly dispatched events"
|
||||
(is (false? (h/dispatches? {} :foo)))
|
||||
(is (true? (h/dispatches? {:dispatch [:foo 1 2 3]} :foo)))
|
||||
(is (false? (h/dispatches? {:dispatch [:foo 1 2 3]} :bar)))
|
||||
(is (true? (h/dispatches? {:dispatch [:foo 1 2 3]} [:foo 1 2 3])))
|
||||
(is (false? (h/dispatches? {:dispatch [:foo 1 2 3]} [:bar 2 3]))))
|
||||
(testing "Should identify an event along multiple dispatched events"
|
||||
(is (false? (h/dispatches? {:dispatch-n [[:bar]]} :foo)))
|
||||
(is (true? (h/dispatches? {:dispatch-n [[:foo 1 2 3]]} :foo)))
|
||||
(is (false? (h/dispatches? {:dispatch-n [[:foo 1 2 3]]} :bar)))
|
||||
(is (h/dispatches? {:dispatch-n [[:foo 1 2 3]]} [:foo 1 2 3]))
|
||||
(is (false? (h/dispatches? {:dispatch-n [[:foo 1 2 3]]} [:bar 2 3])))))
|
||||
|
||||
(deftest rand-str
|
||||
(testing "Generates strings"
|
||||
(is (string? (h/rand-str)))
|
||||
(is (string? (h/rand-str 20))))
|
||||
(testing "Should respect the length for even lengths"
|
||||
(is (= 124 (count (h/rand-str 124))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue