diff options
| author | eltrac <hi@eltr.ac> | 2026-10-16 08:44:26 +0200 |
|---|---|---|
| committer | Eltrac <hi@eltr.ac> | 2026-10-16 08:44:26 +0200 |
| commit | 1db02376cd50e604973d17fd4a04f6e1969fc53c (patch) | |
| tree | c9a7b3832e8dd7b89966b70aeaf991ce56ac098a /test | |
| parent | c2823e5191c2c5634a512df83d5d895eaba4356f (diff) | |
Implement SQLite storage #7 (#73)
- new config `:storage-type` (default `:edn`, also support `:sqlite`)
- `LICENSE` change: add exceptions to `next.jdbc` (which uses EPL)
Reviewed-on: https://codeberg.org/eltrac/weepinbell/pulls/73
Diffstat (limited to 'test')
| -rw-r--r-- | test/weepinbell/storage_test.clj | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/weepinbell/storage_test.clj b/test/weepinbell/storage_test.clj index 91b4ec0..b0df532 100644 --- a/test/weepinbell/storage_test.clj +++ b/test/weepinbell/storage_test.clj @@ -1,6 +1,7 @@ (ns weepinbell.storage-test
(:require [clojure.test :refer [testing is deftest]]
[weepinbell.storage.edn-storage :as edns]
+ [weepinbell.storage.sqlite :as sqlite]
[weepinbell.storage.worker :as worker]
[clojure.java.io :as io]
[clojure.spec.alpha :as s]
@@ -11,9 +12,15 @@ (def test-edn-file "tmp/testfile")
(when (.exists (io/file test-edn-file))
(io/delete-file test-edn-file))
+(def test-sqlite-db "tmp/testsqlite.db")
+(when (.exists (io/file test-sqlite-db))
+ (io/delete-file test-sqlite-db))
(def edn-storage (edns/use-store test-edn-file))
+(def sqlite-storage (sqlite/use-store test-sqlite-db))
(def storages [edn-storage
+ sqlite-storage
+ (last (worker/start sqlite-storage))
(last (worker/start edn-storage))])
;; check if storages conform spec
@@ -22,7 +29,8 @@ (deftest storage-conformity-test
(testing "edn-storage should conform storage spec."
(with-redefs [weepinbell.storage.edn-storage/file-exists? (fn [_] true)]
- (is (spec-check (edns/use-store "source.edn")))))
+ (doseq [storage storages]
+ (is (spec-check storage)))))
(testing "spec-check invalid storage vtables"
(doseq [check [{:get-by-domain (fn [_])}
{:append (fn [_]) :get (fn [_])}
@@ -64,11 +72,11 @@ (defn- test-append-and-get-list [storage]
(let [domain "target.com"
- data [{:webmention {:source "source"
+ data [{:webmention {:source "https://source.net"
:target (str "https://" domain "/a")
:id "1"
:modified (System/currentTimeMillis)}}
- {:webmention {:source "source"
+ {:webmention {:source "https://source.net"
:target (str "https://" domain "/b")
:id "2"
:modified (System/currentTimeMillis)}}]
|
