- Update project overview in README.md and CLAUDE.md to reference Datomic - Replace documentation links from XTDB to Datomic - Update database layer descriptions from XTDB to Datomic - Simplify configuration documentation (remove XTDB-specific connection details) - Update data model to use Datomic entity/attribute naming conventions - Update notes section to reference Datalog instead of XTQL - Remove XTDB dependencies and test fixtures from test suite - Simplify test utilities to work without XTDB test nodes
31 lines
1 KiB
Clojure
31 lines
1 KiB
Clojure
(ns snippets-test
|
|
(:require [cheshire.core :as cheshire]
|
|
[clojure.string :as str]
|
|
[clojure.test :refer [deftest is]]
|
|
[snippets :as main]
|
|
[snippets.app :as app]
|
|
[malli.generator :as mg]
|
|
[rum.core :as rum]))
|
|
|
|
(deftest example-test
|
|
(is (= 4 (+ 2 2))))
|
|
|
|
(defn get-context [db]
|
|
{:biff/db db
|
|
:biff/malli-opts #'main/malli-opts})
|
|
|
|
(deftest send-message-test
|
|
(let [message (mg/generate :string)
|
|
user (mg/generate :user main/malli-opts)
|
|
ctx (get-context {})
|
|
_ (app/send-message ctx {:text (cheshire/generate-string {:text message})})]
|
|
(is (some? message))))
|
|
|
|
(deftest chat-test
|
|
(let [n-messages (+ 3 (rand-int 10))
|
|
now (java.util.Date.)
|
|
messages (for [doc (mg/sample :msg (assoc main/malli-opts :size n-messages))]
|
|
(assoc doc :msg/sent-at now))]
|
|
(let [response (app/chat {:biff/db {}})
|
|
html (rum/render-html response)]
|
|
(is (some? html)))))
|