Files
Synapse/deps/db-sync/test/logseq/db_sync/batch_test.cljs
Dasemu 40631362b3 Initial import of LogDarioSeq baseline
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>
2026-08-25 15:32:15 +02:00

18 lines
749 B
Clojure

(ns logseq.db-sync.batch-test
(:require [cljs.test :refer [deftest is testing]]
[logseq.db-sync.batch :as batch]))
(deftest rows->insert-batches-test
(testing "splits rows into batches based on max params"
(let [rows [[1 "a" nil]
[2 "b" nil]
[3 "c" nil]]
batches (batch/rows->insert-batches "kvs_import" rows {:max-params 6})]
(is (= 2 (count batches)))
(is (= [1 "a" nil 2 "b" nil] (:args (first batches))))
(is (= [3 "c" nil] (:args (second batches))))
(is (string? (:sql (first batches))))
(is (string? (:sql (second batches))))))
(testing "empty rows returns no batches"
(is (= [] (batch/rows->insert-batches "kvs_import" [] {:max-params 6})))))