33 lines
No EOL
1.1 KiB
Clojure
33 lines
No EOL
1.1 KiB
Clojure
(ns dda.backup.cred-rot.domain-test
|
|
(:require
|
|
[clojure.test :refer [deftest is]]
|
|
[clojure.spec.alpha :as s]
|
|
[clojure.spec.test.alpha :as st]
|
|
[dda.backup.cred-rot.domain :as cut]))
|
|
|
|
(deftest test-spec-id
|
|
(is (s/valid? ::cut/id "521e0760"))
|
|
(is (s/valid? ::cut/id "test"))
|
|
(is (s/valid? ::cut/id "123456"))
|
|
(is (not (s/valid? ::cut/id "ROOT")))
|
|
(is (not (s/valid? ::cut/id "Test!"))))
|
|
|
|
(deftest test-spec-username
|
|
(is (s/valid? ::cut/userName "521e0760"))
|
|
(is (s/valid? ::cut/userName "Testuser"))
|
|
(is (s/valid? ::cut/userName "root"))
|
|
(is (s/valid? ::cut/userName "ROOT"))
|
|
(is (not (s/valid? ::cut/userName "test-user"))))
|
|
|
|
(deftest test-spec-hostName
|
|
(let [valid #(s/valid? ::cut/hostName %)]
|
|
(is (valid "test-some-combination-2"))
|
|
(is (valid "backup-restore-65bd9b6ff5-z69sn"))))
|
|
|
|
(deftest test-spec-created
|
|
(let [valid #(s/valid? ::cut/created %)]
|
|
(is (valid "2024-10-18 13:08:16"))
|
|
(is (valid "2032-09-01 12:56:59"))
|
|
(is (not (valid "2024-13-5 13:08:16")))
|
|
(is (not (valid "2024-6-42 13:08:16")))
|
|
(is (not (valid "test"))))) |