c4k-mastodon-bot/src/test/cljc/dda/c4k_mastodon_bot/yaml_test.cljc

23 lines
836 B
Text
Raw Normal View History

2021-07-28 15:05:22 +00:00
(ns dda.c4k-mastodon-bot.yaml-test
2021-02-19 17:41:51 +00:00
(:require
2021-03-17 18:31:12 +00:00
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
2021-07-28 15:05:22 +00:00
[dda.c4k-mastodon-bot.yaml :as cut]))
2021-02-19 17:41:51 +00:00
2021-02-23 08:15:05 +00:00
(deftest should-parse-yaml-string
(is (= {:hallo "welt"}
2021-02-19 17:41:51 +00:00
(cut/from-string "hallo: welt"))))
2021-02-23 08:15:05 +00:00
(deftest should-generate-yaml-string
(is (= "hallo: welt
"
(cut/to-string {:hallo "welt"}))))
2021-02-26 13:29:01 +00:00
(deftest should-convert-config-yml-to-map
(is (= {:apiVersion "v1", :kind "ConfigMap"
:metadata {:name "mastodon-bot",
2021-07-28 15:05:22 +00:00
:labels {:app.kubernetes.io/name "c4k-mastodon-bot"}},
2021-02-26 13:29:01 +00:00
:data {:config.edn "some-config-value\n",
:credentials.edn "some-credentials-value\n"}}
2021-02-26 13:44:02 +00:00
(cut/from-string (cut/load-resource "config.yaml")))))