Establishes version control for the personal Logseq DB fork before starting the server-client architecture migration and domain features described in docs/agent-guide and the approved implementation plan. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
32 lines
1.2 KiB
Clojure
32 lines
1.2 KiB
Clojure
(ns logseq.db-sync.node-config-test
|
|
(:require [cljs.test :refer [deftest is testing]]
|
|
[logseq.db-sync.node.config :as config]))
|
|
|
|
(defn- throws? [f]
|
|
(try
|
|
(f)
|
|
false
|
|
(catch :default _ true)))
|
|
|
|
(deftest normalize-config-drops-unknown-keys-test
|
|
(let [cfg (config/normalize-config {:port 7777
|
|
:unknown-key "value"
|
|
:legacy-auth-key "value"})]
|
|
(is (= 7777 (:port cfg)))
|
|
(is (nil? (:unknown-key cfg)))
|
|
(is (nil? (:legacy-auth-key cfg)))))
|
|
|
|
(deftest normalize-config-storage-driver-test
|
|
(testing "sqlite storage driver accepted"
|
|
(let [cfg (config/normalize-config {:storage-driver "sqlite"})]
|
|
(is (= "sqlite" (:storage-driver cfg)))))
|
|
(testing "unsupported storage driver throws"
|
|
(is (throws? #(config/normalize-config {:storage-driver "other"})))))
|
|
|
|
(deftest normalize-config-assets-driver-test
|
|
(testing "filesystem assets driver accepted"
|
|
(let [cfg (config/normalize-config {:assets-driver "filesystem"})]
|
|
(is (= "filesystem" (:assets-driver cfg)))))
|
|
(testing "unsupported assets driver throws"
|
|
(is (throws? #(config/normalize-config {:assets-driver "s3"})))))
|