dda-backup/test/dda/backup/management/domain_test.clj
2024-08-16 18:10:50 +02:00

32 lines
1.3 KiB
Clojure

(ns dda.backup.management.domain-test
(:require
[clojure.test :refer [deftest is are testing run-tests]]
[clojure.spec.test.alpha :as st]
[dda.backup.management.domain :as cut]))
(st/instrument `cut/init-repo-command)
(st/instrument `cut/unlock-repo-command)
(st/instrument `cut/forget-command)
(deftest should-calculate-init-repo-command
(is (= [["restic" "-r" "repo/dir" "-v" "init"]]
(cut/init-repo-command {:restic-repository "repo"
:backup-path "dir"
:days-to-keep 39
:months-to-keep 3}))))
(deftest should-calculate-unlock-repo-command
(is (= [["restic" "-r" "repo/dir" "-v" "--cleanup-cache" "unlock"]]
(cut/unlock-repo-command {:restic-repository "repo"
:backup-path "dir"
:days-to-keep 39
:months-to-keep 3}))))
(deftest should-calculate-forget-command
(is (= [["restic" "-r" "repo/dir" "-v" "forget"
"--group-by" "" "--keep-last" "1"
"--keep-daily" "39" "--keep-monthly" "3" "--prune"]]
(cut/forget-command {:restic-repository "repo"
:backup-path "dir"
:days-to-keep 39
:months-to-keep 3}))))