Basic test for ds/fulltext?.
This commit is contained in:
parent
bd3a6d49f2
commit
63342e344f
2 changed files with 8 additions and 1 deletions
|
@ -39,3 +39,5 @@
|
||||||
(def ident db/ident)
|
(def ident db/ident)
|
||||||
|
|
||||||
(def <q db/<?q)
|
(def <q db/<?q)
|
||||||
|
|
||||||
|
(def schema db/schema)
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
[datomish.api :as d]
|
[datomish.api :as d]
|
||||||
[datomish.db.debug :refer [<datoms-after <transactions-after <shallow-entity <fulltext-values]]
|
[datomish.db.debug :refer [<datoms-after <transactions-after <shallow-entity <fulltext-values]]
|
||||||
[datomish.util :as util #?(:cljs :refer-macros :clj :refer) [raise cond-let]]
|
[datomish.util :as util #?(:cljs :refer-macros :clj :refer) [raise cond-let]]
|
||||||
|
[datomish.schema :as ds]
|
||||||
[datomish.sqlite :as s]
|
[datomish.sqlite :as s]
|
||||||
[datomish.sqlite-schema]
|
[datomish.sqlite-schema]
|
||||||
[datomish.datom]
|
[datomish.datom]
|
||||||
|
@ -412,9 +413,13 @@
|
||||||
{:db/id :db.part/db :db.install/attribute (d/id-literal :db.part/db -2)}
|
{:db/id :db.part/db :db.install/attribute (d/id-literal :db.part/db -2)}
|
||||||
]
|
]
|
||||||
tx0 (:tx (<? (d/<transact! conn schema)))]
|
tx0 (:tx (<? (d/<transact! conn schema)))]
|
||||||
|
(testing "Schema checks"
|
||||||
|
(is (ds/fulltext? (d/schema (d/db conn))
|
||||||
|
(d/entid (d/db conn) :test/fulltext))))
|
||||||
(try
|
(try
|
||||||
(testing "Can add fulltext indexed datoms"
|
(testing "Can add fulltext indexed datoms"
|
||||||
(let [{tx1 :tx txInstant1 :txInstant} (<? (d/<transact! conn [[:db/add 101 :test/fulltext "test this"]]))]
|
(let [{tx1 :tx txInstant1 :txInstant}
|
||||||
|
(<? (d/<transact! conn [[:db/add 101 :test/fulltext "test this"]]))]
|
||||||
(is (= (<? (<fulltext-values (d/db conn)))
|
(is (= (<? (<fulltext-values (d/db conn)))
|
||||||
[[1 "test this"]]))
|
[[1 "test this"]]))
|
||||||
(is (= (<? (<datoms-after (d/db conn) tx0))
|
(is (= (<? (<datoms-after (d/db conn) tx0))
|
||||||
|
|
Loading…
Reference in a new issue