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

Setup tests

commit 1b86fa1477d9cbad441e7616b6f1adbceec76c9c
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon May 28 19:52:48 2018 +0200

    Cache build directories for (hopefully) faster builds

commit b614e1fa8437bb20cb5fcb05d6ab7ad318984f01
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon May 28 19:49:34 2018 +0200

    Fix undeclared var in test

commit f0f30e6a546ad0e4a7f65538d485b5544f7733c3
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon May 28 19:27:13 2018 +0200

    Configure travis and fix dependencies

commit 5a3f432d9e9ed34e21a6940a18f11fa4d0ef9b7d
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon May 28 19:22:33 2018 +0200

    Remove build folders from git

commit 44095cbd34e2ed6f70d43b7c72f5cb4bacb18913
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon May 28 19:17:05 2018 +0200

    Add first real test

commit 02a0ef51c61c15ddc6de88f34aa5fd2817fdca88
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon May 28 16:38:40 2018 +0200

    Add growl notifications

commit 5b09be97e04e64ecab5aba3e063f584e48d21c0a
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon May 28 14:29:02 2018 +0200

    Add karma watcher

commit 6d7859f7fd420e4057277da3605a4df5985d8ae9
Author: Arne Schlüter <arne@schlueter.is>
Date:   Mon May 28 14:20:12 2018 +0200

    Add karma and set it up for single-run tests
This commit is contained in:
Arne Schlüter 2018-05-28 19:57:03 +02:00
commit 629872ec97
11 changed files with 2840 additions and 44 deletions

View file

@ -3,7 +3,7 @@
[ajax.core :as ajax]
[airsonic-ui.routes :as routes]
[airsonic-ui.db :as db]
[airsonic-ui.api :as api]
[airsonic-ui.utils.api :as api]
[day8.re-frame.tracing :refer-macros [fn-traced]])) ; <- useful to debug handlers
;; this is where all of the event handling takes place; the names put the events into

View file

@ -1,17 +1,18 @@
(ns airsonic-ui.api
(ns airsonic-ui.utils.api
(:require [clojure.string :as str]
[airsonic-ui.config :as config]))
(def default-params {:f "json"
:c "airsonic-ui-cljs"
:v "1.15.0"})
(defn- encode [c]
(js/encodeURIComponent c))
(defn url
"Returns an absolute url to an API endpoint"
[server endpoint params]
(let [query (->> (assoc params
:f "json"
:c "airsonic-ui-cljs"
:v "1.15.0")
(let [query (->> (merge default-params params)
(map (fn [[k v]] (str (encode (name k)) "=" (encode v))))
(str/join "&"))]
(str server (when-not (str/ends-with? server "/") "/") "rest/" endpoint "?" query)))
@ -21,14 +22,3 @@
(defn cover-url [server credentials item size]
(url server "getCoverArt" (merge {:id (:coverArt item) :size size} credentials)))
(defn- api-error?
"We need to look at the message body because the subsonic api always responds
with status 200"
[response]
(= "failed" (-> response :subsonic-response :status)))
(defn- error-message
[response]
(let [{:keys [code message]} (-> response :subsonic-response :error)]
(str "Code " code ": " message)))

View file

@ -1,7 +1,7 @@
(ns airsonic-ui.views.cover
(:require [re-frame.core :refer [subscribe]]
[airsonic-ui.subs :as subs]
[airsonic-ui.api :as api]))
[airsonic-ui.utils.api :as api]))
;; FIXME: The direct dependency on these subs is a bit ugly