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

Cache API responses and make sure we remember more than just one

Closes #21.
Squashed commit of the following:

commit 964b29cf127cf51de86543d040bcb6c674b36d7e
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Aug 22 17:56:48 2018 +0200

    Pass content for current route nicely to views

commit b469a0a4b69457ddf3a679ac1acc82fbaffdc8fd
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Aug 22 16:01:04 2018 +0200

    Add response cache in app-db

commit da9faf89138f42ee544efc64c2e46787091b3dc7
Author: Arne Schlüter <arne@schlueter.is>
Date:   Wed Aug 22 13:40:57 2018 +0200

    Move api helpers and tests to own namespace
This commit is contained in:
Arne Schlüter 2018-08-22 17:58:03 +02:00
commit 2cdae0d683
13 changed files with 222 additions and 94 deletions

View file

@ -1,7 +1,7 @@
(ns airsonic-ui.subs-test
(:require [cljs.test :refer [deftest testing is]]
[airsonic-ui.fixtures :as fixtures]
[airsonic-ui.utils.api :as api]
[airsonic-ui.api.helpers :as api]
[airsonic-ui.subs :as subs]))
(deftest booting
@ -10,17 +10,17 @@
is-booting? (fn is-booting? [db]
(subs/is-booting? db [:subs/is-booting?]))]
(testing "Should be false when we don't have previous credentials"
(is (not (is-booting? {:current-route route})))
(is (not (is-booting? {:current-route route
(is (not (is-booting? {:routes/current-route route})))
(is (not (is-booting? {:routes/current-route route
:credentials {}}))) )
(testing "Should be true when we have unverified credentials"
(is (true? (is-booting? {:current-route route
(is (true? (is-booting? {:routes/current-route route
:credentials fixtures/credentials}))))
(testing "Should be false when we have verified credentials"
(is (not (is-booting? {:current-route route
(is (not (is-booting? {:routes/current-route route
:credentials verified-credentials}))))
(testing "Should be true when routing is not yet set up"
(is (true? (is-booting? {:current-route nil
(is (true? (is-booting? {:routes/current-route nil
:credentials verified-credentials}))))))
(deftest cover-images