dda-backup/test/dda/backup/core/domain_test.clj

21 lines
1 KiB
Clojure

(ns dda.backup.core.domain-test
(:require
[clojure.test :refer [deftest is are testing run-tests]]
[clojure.spec.alpha :as s]
[dda.backup.core.domain :as cut]))
(deftest should-verify-command
(is (= {:app "restic", :params ["-r" "repo/dir" "-v" "init" "--cacert" "ca"]}
(s/conform ::cut/command ["restic" "-r" "repo/dir" "-v" "init" "--cacert" "ca"])))
(is (= {:app "restic"}
(s/conform ::cut/command ["restic"])))
(is (= {:opts {:dir "dir"} :app "restic", :params ["-r" "repo/dir" "-v" "init" "--cacert" "ca"]}
(s/conform ::cut/command [{:dir "dir"} "restic" "-r" "repo/dir" "-v" "init" "--cacert" "ca"])))
(is (= {:opts {:dir "dir"} :app "restic"}
(s/conform ::cut/command [{:dir "dir"} "restic"]))))
(deftest should-verify-commands
(is (= [{:app "ls"}
{:app "restic", :params ["-r" "repo/dir" "-v" "init" "--cacert" "ca"]}]
(s/conform ::cut/commands [["ls"]
["restic" "-r" "repo/dir" "-v" "init" "--cacert" "ca"]]))))