From 8c761b69e7d64b33a8f1512d667feb89d849bbc7 Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 19 Mar 2021 15:53:47 +0100 Subject: [PATCH] fix tests --- public/index.html | 4 ++-- src/main/cljc/dda/k8s_mastodon_bot/core.cljc | 7 ------- src/main/cljs/dda/k8s_mastodon_bot/browser.cljs | 7 +++++-- src/test/cljc/dda/k8s_mastodon_bot/core_test.cljc | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/public/index.html b/public/index.html index 3495843..53eb390 100644 --- a/public/index.html +++ b/public/index.html @@ -66,13 +66,13 @@



+

- + diff --git a/src/main/cljc/dda/k8s_mastodon_bot/core.cljc b/src/main/cljc/dda/k8s_mastodon_bot/core.cljc index 1dfe9d0..0e21ce4 100644 --- a/src/main/cljc/dda/k8s_mastodon_bot/core.cljc +++ b/src/main/cljc/dda/k8s_mastodon_bot/core.cljc @@ -2,16 +2,11 @@ (:require [clojure.string :as cs] [clojure.spec.alpha :as s] - [clojure.spec.test.alpha :as st] #?(:clj [orchestra.core :refer [defn-spec]] :cljs [orchestra.core :refer-macros [defn-spec]]) - [expound.alpha :as expound] [mastodon-bot.core-domain :as cd] [dda.k8s-mastodon-bot.yaml :as yaml])) -#?(:clj (alter-var-root #'s/*explain-out* (constantly expound/printer)) - :cljs (set! s/*explain-out* expound/printer)) - (def config? cd/config?) (def auth? (s/keys :req-un [::cd/auth])) @@ -34,5 +29,3 @@ [(yaml/to-string (generate-config my-config my-auth)) "---" (yaml/to-string (generate-deployment))])) - -(st/instrument 'dda.k8s-mastodon-bot.core) diff --git a/src/main/cljs/dda/k8s_mastodon_bot/browser.cljs b/src/main/cljs/dda/k8s_mastodon_bot/browser.cljs index 312b188..c411c93 100644 --- a/src/main/cljs/dda/k8s_mastodon_bot/browser.cljs +++ b/src/main/cljs/dda/k8s_mastodon_bot/browser.cljs @@ -82,8 +82,11 @@ (-> js/document (.getElementById "generate-button") (.addEventListener "click" - #(-> (core/generate (config-from-document) (auth-from-document)) - (set-output!)))) + #(do (validate-config!) + (validate-auth!) + (set-validated!) + (-> (core/generate (config-from-document) (auth-from-document)) + (set-output!))))) (-> (config) (.addEventListener "blur" #(do (validate-config!) diff --git a/src/test/cljc/dda/k8s_mastodon_bot/core_test.cljc b/src/test/cljc/dda/k8s_mastodon_bot/core_test.cljc index 5c4c8d3..9a39c70 100644 --- a/src/test/cljc/dda/k8s_mastodon_bot/core_test.cljc +++ b/src/test/cljc/dda/k8s_mastodon_bot/core_test.cljc @@ -10,4 +10,4 @@ :labels {:app.kubernetes.io/name "k8s-mastodon-bot"}}, :data {:config.edn "some-config-value\n", :credentials.edn "some-credentials-value\n"}} - (cut/from-string (cut/load-resource "config.yaml"))))) + (cut/generate-config "some-config-value\n" "some-credentials-value\n"))))