1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-06 18:33:38 +02:00

Move artists into library (#68)

* Use more sensible naming for api responses

* Move artist overview into library; closes #50 and #52

* Fix sass live-reload

* Move editor config out of shadow-cljs.edn
This commit is contained in:
heyarne 2019-12-08 00:56:45 +01:00 committed by GitHub
commit 930bf55390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 82 additions and 47 deletions

View file

@ -7,7 +7,7 @@
(deftest api-failure-notifcations
(testing "Should show an error notification when airsonic responds with an error"
(let [fx (events/good-api-response {} [:api/good-response "ping" nil (:error fixtures/responses)])
(let [fx (events/api-success {} [:api.response/ok "ping" nil (:error fixtures/responses)])
ev (:dispatch fx)]
(is (= :notification/show (first ev)))
(is (= :error (second ev))))))
@ -18,13 +18,13 @@
(testing "Should be cached"
(testing "when the response was successful"
(let [endpoint "getScanStatus"
successful (events/good-api-response {} [:api/good-response endpoint nil (:ok fixtures/responses)])
unsuccessful (events/good-api-response {} [:api/good-response endpoint nil (:error fixtures/responses)])]
successful (events/api-success {} [:api.response/ok endpoint nil (:ok fixtures/responses)])
unsuccessful (events/api-success {} [:api.response/ok endpoint nil (:error fixtures/responses)])]
(is (map? (cache successful [endpoint])))
(is (nil? (cache unsuccessful [endpoint])))))
(testing "in an unwrapped format"
(let [endpoint "getScanStatus"
fx (events/good-api-response {} [:api/good-response endpoint nil (:ok fixtures/responses)])]
fx (events/api-success {} [:api.response/ok endpoint nil (:ok fixtures/responses)])]
(is (= #{:count :scanning} (set (keys (cache fx [endpoint]))))))))
(testing "When being issued"
(let [endpoint "getScanStatus"
@ -34,16 +34,16 @@
(is (contains? fx :http-xhrio)))
(testing "should indicate that a request is ongoing"
(is (true? (:api/is-loading? (cache fx [endpoint]))) "for non-cached responses")
(is (true? (-> (events/good-api-response fx [:api/good-response endpoint nil (:ok fixtures/responses)])
(is (true? (-> (events/api-success fx [:api.response/ok endpoint nil (:ok fixtures/responses)])
(events/api-request [:api/request endpoint])
(cache [endpoint])
:api/is-loading?)) "for cached responses"))
(testing "should remove the indication that a request is ongoing when there is a response"
(is (not (:api/is-loading? (-> (events/good-api-response fx [:api/good-response endpoint nil (:ok fixtures/responses)])
(is (not (:api/is-loading? (-> (events/api-success fx [:api.response/ok endpoint nil (:ok fixtures/responses)])
(cache [endpoint])))) "for a good response")
(is (not (:api/is-loading? (-> (merge fx (events/good-api-response fx [:api/good-response endpoint nil (:error fixtures/responses)]))
(is (not (:api/is-loading? (-> (merge fx (events/api-success fx [:api.response/ok endpoint nil (:error fixtures/responses)]))
(cache [endpoint])))) "when an error is returned")
(is (not (:api/is-loading? (-> (merge fx (events/failed-api-response fx [:api/failed-response endpoint]))
(is (not (:api/is-loading? (-> (merge fx (events/api-failure fx [:api.response/failed endpoint]))
(cache [endpoint])))) "when communication with the server failed"))))
(testing "Should be able to avoid the cache"
;; FIXME: Implement this

View file

@ -62,7 +62,7 @@
(testing "invokes correct callback on server response"
(is (= [:credentials/authentication-response fixtures/credentials] (:on-success request))))
(testing "invokes correct callback when server is not reachable"
(is (= [:api/failed-response] (:on-failure request))))))
(is (= [:api.response/failed] (:on-failure request))))))
(deftest authentication-response
(testing "On success"