Validate valid inputs

This commit is contained in:
bom 2024-07-02 15:44:23 +02:00
parent 85f9b3285a
commit e69d99b7f3
3 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,19 @@
(ns dda.c4k-shynet.core-test
(:require
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
#?(:cljs [shadow.resource :as rc])
[clojure.spec.alpha :as s]
[dda.c4k-common.yaml :as yaml]
[dda.c4k-shynet.core :as cut]))
#?(:cljs
(defmethod yaml/load-resource :jitsi-test [resource-name]
(case resource-name
"valid-auth.yaml" (rc/inline "valid-auth.yaml")
"valid-config.yaml" (rc/inline "valid-config.yaml")
(throw (js/Error. "Undefined Resource!")))))
(deftest validate-valid-resources
(is (s/valid? cut/config? (yaml/load-as-edn "valid-config.yaml")))
(is (s/valid? cut/auth? (yaml/load-as-edn "valid-auth.yaml"))))