yaml from/to-string
This commit is contained in:
parent
9b4d355fd7
commit
8919466f13
2 changed files with 12 additions and 4 deletions
|
@ -1,8 +1,11 @@
|
|||
(ns dda.k8s-mastodon-bot.yaml
|
||||
(:require
|
||||
[aero.core :as aero]
|
||||
["js-yaml" :as yaml]
|
||||
))
|
||||
|
||||
(defn from-string [input]
|
||||
42)
|
||||
(js->clj (yaml/load input)
|
||||
:keywordize-keys true))
|
||||
|
||||
(defn to-string [edn]
|
||||
(yaml/dump (clj->js edn)))
|
|
@ -3,6 +3,11 @@
|
|||
[clojure.test :refer [deftest is testing are]]
|
||||
[dda.k8s-mastodon-bot.yaml :as cut]))
|
||||
|
||||
(deftest should-pars-yaml-string
|
||||
(is (= 43
|
||||
(deftest should-parse-yaml-string
|
||||
(is (= {:hallo "welt"}
|
||||
(cut/from-string "hallo: welt"))))
|
||||
|
||||
(deftest should-generate-yaml-string
|
||||
(is (= "hallo: welt
|
||||
"
|
||||
(cut/to-string {:hallo "welt"}))))
|
||||
|
|
Loading…
Reference in a new issue