Added validate-config tests.
This commit is contained in:
parent
f601f272d4
commit
2787f8959f
@ -414,3 +414,46 @@
|
||||
(p/let [r (advisorycircular/closest-airport conf 0 0)]
|
||||
(is (= r a3)))))
|
||||
(done)))))
|
||||
|
||||
|
||||
(deftest validate-config
|
||||
(testing "Good config w/ lat-lon-radius"
|
||||
(advisorycircular/validate-config
|
||||
{:adsbx {:api-key "my-adsbx-key"
|
||||
:url "http://adsbx"}
|
||||
:aircraft-info-db-path "/"
|
||||
:pelias {:url "http://pelias/"}
|
||||
:lat 0
|
||||
:lon 1
|
||||
:radius-km 5}))
|
||||
(testing "Bad config missing radius"
|
||||
(is (thrown-with-msg?
|
||||
js/Error #"Missing configuration values.*radius"
|
||||
(advisorycircular/validate-config
|
||||
{:adsbx {:api-key "my-adsbx-key"
|
||||
:url "http://adsbx"}
|
||||
:aircraft-info-db-path "/"
|
||||
:pelias {:url "http://pelias/"}
|
||||
:lat 0
|
||||
:lon 1}))))
|
||||
(testing "Bad config missing everything"
|
||||
(is (thrown-with-msg?
|
||||
js/Error #"Missing configuration values.*adsbx"
|
||||
(advisorycircular/validate-config {}))))
|
||||
(testing "Bad config missing lat-lon-radius"
|
||||
(is (thrown-with-msg?
|
||||
js/Error #"Missing configuration values.*lat.*lon.*radius-km"
|
||||
(advisorycircular/validate-config
|
||||
{:adsbx {:api-key "my-adsbx-key"
|
||||
:url "http://adsbx"}
|
||||
:aircraft-info-db-path "/"
|
||||
:pelias {:url "http://pelias/"}}))))
|
||||
(testing "Bad config with icaos instead of lat/lon/radius"
|
||||
(is (thrown-with-msg?
|
||||
js/Error #"Missing configuration values.*lat.*lon.*radius-km"
|
||||
(advisorycircular/validate-config
|
||||
{:adsbx {:api-key "my-adsbx-key"
|
||||
:url "http://adsbx"}
|
||||
:aircraft-info-db-path "/"
|
||||
:pelias {:url "http://pelias/"}
|
||||
:icaos ["123" "456"]})))))
|
||||
|
Loading…
Reference in New Issue
Block a user