From 7a7e05a715112a2d95824049789e5429d204b529 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 15 Dec 2023 19:03:58 +0100 Subject: [PATCH] add test --- .../cljc/dda/c4k_forgejo/backup_test.cljc | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/cljc/dda/c4k_forgejo/backup_test.cljc diff --git a/src/test/cljc/dda/c4k_forgejo/backup_test.cljc b/src/test/cljc/dda/c4k_forgejo/backup_test.cljc new file mode 100644 index 0000000..af9eb55 --- /dev/null +++ b/src/test/cljc/dda/c4k_forgejo/backup_test.cljc @@ -0,0 +1,30 @@ +(ns dda.c4k-forgejo.backup-test + (:require + #?(:clj [clojure.test :refer [deftest is are testing run-tests]] + :cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) + [clojure.spec.test.alpha :as st] + [dda.c4k-forgejo.backup :as cut])) + +(st/instrument `cut/generate-config) + +(deftest should-generate-backup-config + (testing "federated" + (is (= {:apiVersion "v1", + :kind "ConfigMap", + :metadata + {:name "backup-config", + :labels + #:app.kubernetes.io{:name "backup", :part-of "forgejo"}}, + :data {:restic-repository "s3:s3.amazonaws.com/backup/federated-repo"}} + (cut/generate-config + {:restic-repository "s3:s3.amazonaws.com/backup/federated-repo"})))) + (testing "non-federated" + (is (= {:apiVersion "v1", + :kind "ConfigMap", + :metadata + {:name "backup-config", + :labels + #:app.kubernetes.io{:name "backup", :part-of "forgejo"}}, + :data {:restic-repository "s3:s3.amazonaws.com/backup/repo"}} + (cut/generate-config + {:restic-repository "s3:s3.amazonaws.com/backup/repo"}))))) \ No newline at end of file