-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests for util/config and core/hooks, small mod to core/hooks, …
…comments (#162) * looks OK * better message
- Loading branch information
1 parent
55deb33
commit 9f6f7b6
Showing
4 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(ns yetibot.core.test.util.config | ||
(:require | ||
[midje.sweet :refer [=> fact facts every-checker]] | ||
[yetibot.core.util.config :as c] | ||
[yetibot.core.loader :as ldr])) | ||
|
||
(facts "about load-edn!" | ||
(fact "loading non-existent config file returns nil" | ||
(c/load-edn! "nope.edn") => nil) | ||
(let [cfg (c/load-edn! "config/config.sample.edn")] | ||
(fact "loading sample config file returns non-empty map" | ||
cfg => (every-checker map? not-empty)) | ||
(fact "loading sample config file returns expected value" | ||
(get-in cfg [:yetibot :url]) | ||
=> "http://localhost:3003"))) | ||
|
||
(facts "about get-config" | ||
(let [cfg (c/load-edn! "config/config.sample.edn")] | ||
(fact "get's valid map path and tests against spec" | ||
(c/get-config cfg ::ldr/url [:yetibot :url]) | ||
=> {:value "http://localhost:3003"}) | ||
(fact "get's invalid map path and tests against valid spec" | ||
(:error (c/get-config cfg | ||
::ldr/url [:yetibot :doesnotexist])) | ||
=> :not-found) | ||
(fact "get's valid map path and tests against invalid spec" | ||
(:error (c/get-config cfg | ||
::ldr/plugin-config [:yetibot :url])) | ||
=> :invalid))) |