summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-10-30 14:58:17 +0800
committereltrac <hi@eltr.ac>2026-10-30 14:58:17 +0800
commitc4c1575a20fffd9cd9b76e369d3bda7f88545e41 (patch)
tree715d6ecd59559f2e376fe7bfbd8450e9d4c59316
parente2b441cfc31b2f8f462424920bc20a01d003a07d (diff)
test: create dummy file before delete, to avoid test failure
-rw-r--r--test/weepinbell/downloader_test.clj6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/weepinbell/downloader_test.clj b/test/weepinbell/downloader_test.clj
index 469c9ba..0d92f11 100644
--- a/test/weepinbell/downloader_test.clj
+++ b/test/weepinbell/downloader_test.clj
@@ -34,11 +34,15 @@
(testing "Exception/Error thrown while downloading"
(with-redefs [weepinbell.http.client/get!
(fn [& _] (throw (.Error "Test error")))]
- (is (false? (download-file "" "")))))
+ (let [dest "tmp/error-thrown-while-downloading"]
+ (io/make-parents dest)
+ (spit "tmp/test" dest)
+ (is (false? (download-file "" "tmp/test"))))))
(testing "Deletes possibly corrupted file when failure is caught"
(with-redefs [weepinbell.http.client/get!
(fn [& _] (throw (.Error "Test error")))]
(let [dest "dest"]
+ (io/make-parents dest)
(spit dest "CORRUPTED")
(is (false? (download-file "" dest)))
(is (not (.exists (io/file dest))))))))