Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
klauswuestefeld committed May 21, 2024
1 parent d1005aa commit 8e8f96f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/prevayler_clj_aws/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(defonce localstack-port
(memoize
#(or (some-> (System/getenv "LOCALSTACK_PORT") (Integer/parseInt))
(-> (tc/create {:image-name "localstack/localstack:1.0.4"
(-> (tc/create {:image-name "localstack/localstack"
:exposed-ports [4566]})
(tc/start!)
:mapped-ports
Expand Down Expand Up @@ -120,4 +120,13 @@
(catch Exception _))
prev2 (prev! opts)]
(is (= :initial-state @prev1))
(is (= :initial-state @prev2)))))
(is (= :initial-state @prev2))))

(testing "snapshot! starts new journal with current state (business function is never called during start up)"
(let [opts (gen-opts :initial-state [] :business-fn (fn [state event _] (conj state event)))
prev1 (prev! opts)]
(prevayler/handle! prev1 1)
(prevayler/handle! prev1 2)
(prevayler/snapshot! prev1))
(let [prev2 (gen-opts :initial-state [] :business-fn (constantly "rubbish"))]
(is (= [1 2] @prev2)))))

0 comments on commit 8e8f96f

Please sign in to comment.