diff options
| author | eltrac <hi@eltr.ac> | 2026-09-14 17:05:47 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-09-14 17:07:16 +0800 |
| commit | a54869de9f6e12f40996506966b396cef3c37d7c (patch) | |
| tree | f3c5386c805749d2842a401868e5affc026b87d9 /test | |
| parent | 76099c6ac901601f5ce2280d658d979e4f3cb883 (diff) | |
storage-test: running tests no longer generates unwanted 'source.edn' file
the old weepinbell.storage-test/edn-storage-conformity-test `spit` a
file for `edn-storage/use-store` to check if data file exists
this is unnecessary and annoying because it generates a confusing file
every time tests are run, also during building.
the solution is to use `with-redefs` to make `file-exists?` always
return `true`
Diffstat (limited to 'test')
| -rw-r--r-- | test/weepinbell/storage_test.clj | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/weepinbell/storage_test.clj b/test/weepinbell/storage_test.clj index d218b66..0bbf07e 100644 --- a/test/weepinbell/storage_test.clj +++ b/test/weepinbell/storage_test.clj @@ -2,10 +2,11 @@ (:require [clojure.test :refer [testing is deftest]]
[weepinbell.storage.edn-storage :as edns]
[clojure.spec.alpha :as s]
+ [weepinbell.utils]
[weepinbell.spec]))
(deftest edn-storage-conformity-test
(testing "edn-storage should conform storage spec."
- (spit "source.edn" "")
- (is (s/valid? :weepinbell.spec/storage
- (edns/use-store "source.edn")))))
+ (with-redefs [weepinbell.utils/file-exists? (fn [_] true)]
+ (is (s/valid? :weepinbell.spec/storage
+ (edns/use-store "source.edn"))))))
|
