Tests pass.

This commit is contained in:
John Wiseman 2020-10-12 12:19:31 -07:00
parent c72d24dcbf
commit f601f272d4

View File

@ -398,22 +398,19 @@
(let [a1 {:properties {:distance 1.5 :label "Bridge heliport"}} (let [a1 {:properties {:distance 1.5 :label "Bridge heliport"}}
a2 {:properties {:distance 0.5 :label "New York Seaport"}} a2 {:properties {:distance 0.5 :label "New York Seaport"}}
a3 {:properties {:distance 1.0 :label "LAX"}} a3 {:properties {:distance 1.0 :label "LAX"}}
nearby (fn [config lat lon options] nearby (fn [_config _lat _lon _options]
{:features [a1 a2 a3]})] {:features [a1 a2 a3]})]
;; This is pretty hacky, but.
(set! pelias/nearby nearby)
(println (nearby 1 2 3 4))
(async (async
done done
(p/do (p/do
(testing "closest-airport 1" (testing "closest-airport 1"
;; Note that the with-redefs only works for the first (p/let [r (advisorycircular/closest-airport {} 0 0)]
;; binding clause in p/let. (is (= r a2))))
(with-redefs [pelias/nearby nearby]
(p/let [r (advisorycircular/closest-airport {} 0 0)]
(is (= r a2)))))
(testing "closest-airport with blocklist" (testing "closest-airport with blocklist"
(with-redefs [pelias/nearby nearby] (let [conf {:airport {:blocklist ["seaport"]}}]
(let [conf {:airport {:blocklist ["seaport"]}}] (p/let [r (advisorycircular/closest-airport conf 0 0)]
(p/let [r (advisorycircular/closest-airport conf 0 0)] (is (= r a3)))))
(is (= r a3)))))) (done)))))
(done))
)))