1
0
Fork 0
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:
Arne Schlüter 2018-08-01 18:36:47 +02:00
commit 80225d46b1
10 changed files with 187 additions and 69 deletions

View file

@ -93,7 +93,9 @@
(testing "Should redirect to the login screen"
(is (dispatches? fx [:routes/do-navigation [::routes/login]])))
(testing "Should reset the app-db"
(is (= db/default-db (:db fx)))))
(is (= db/default-db (:db fx))))
(testing "Should stop currently playing songs"
(is (contains? fx :audio/stop))))
(testing "Should be able to keep a redirection parameter"
(let [redirect [:route {:with-data #{1 2 3 4 5}}]
navigation-event (:dispatch (events/logout {} [:_ :redirect-to redirect]))]
@ -102,13 +104,15 @@
(is (= ::routes/login route-id))
(is (contains? query :redirect))))))
(defn- first-notification [fx]
(-> (get-in fx [:db :notifications]) vals first))
(deftest api-interaction
(testing "Should show an error notification when airsonic responds with an error"
(let [fx (events/good-api-response {} [:_ (:error fixtures/responses)])]
(is (= :error (-> fx :dispatch second))))))
(let [fx (events/good-api-response {} [:_ (:error fixtures/responses)])
ev (:dispatch fx)]
(is (= :notification/show (first ev)))
(is (= :error (second ev))))))
(defn- first-notification [fx]
(-> (get-in fx [:db :notifications]) vals first))
(deftest user-notifications
(testing "Should be able to display a message with an assigned level"