diff --git a/src/main/lemondronor/circlebot/generation.cljc b/src/main/lemondronor/circlebot/generation.cljc index 300e813..5024cbe 100644 --- a/src/main/lemondronor/circlebot/generation.cljc +++ b/src/main/lemondronor/circlebot/generation.cljc @@ -47,6 +47,14 @@ (defmulti expand% (fn [template data] (first template))) +;; (defmethod expand% :varref [template data] +;; (let [var (keyword (second template)) +;; var-path (string/split var #"\.") +;; val (get-in data var-path)] +;; (if (or (nil? val) (= val "")) +;; '() +;; (list {:varrefs [var] :text (str (data var))})))) + (defmethod expand% :varref [template data] (let [var (keyword (second template)) val (data var)] diff --git a/src/main/lemondronor/circlebot/pelias.cljs b/src/main/lemondronor/circlebot/pelias.cljs index 3427503..b809c3c 100644 --- a/src/main/lemondronor/circlebot/pelias.cljs +++ b/src/main/lemondronor/circlebot/pelias.cljs @@ -11,7 +11,7 @@ (logging/deflog "pelias" logger) -(def base-pelias-url "http://raytheon.local:4000/v1") + (def base-pelias-url "http://lockheed.local:4000/v1") ;; Does an HTTP GET to a pelias API url. Returns a promise that diff --git a/src/test/lemondronor/circlebot/generation_test.cljs b/src/test/lemondronor/circlebot/generation_test.cljs index d9be395..afa0101 100644 --- a/src/test/lemondronor/circlebot/generation_test.cljs +++ b/src/test/lemondronor/circlebot/generation_test.cljs @@ -64,3 +64,14 @@ :country "Country"} {:neighborhood 5 :locality 2}))))) + + +(deftest var-paths + (is (= "Hello, John" + (generation/generate + [(generation/parse-template "Hello, {person.name}")] + {:person {:name "John"}}))) + (is (= 9 + (generation/generate + [(generation/parse-template "Hello, {person.name}")] + {:person {:age 49}}))))