mentat/tx/fixtures/test_add.edn

67 lines
2.2 KiB
Clojure
Raw Normal View History

[{:test/label ":db.cardinality/one, insert"
:test/assertions
[[:db/add 100 :db/ident :keyword/value1]
[:db/add 101 :db/ident :keyword/value2]]
:test/expected-transaction
#{[100 :db/ident :keyword/value1 ?tx1 true]
[101 :db/ident :keyword/value2 ?tx1 true]
[?tx1 :db/txInstant ?ms1 ?tx1 true]}
:test/expected-datoms
#{[100 :db/ident :keyword/value1]
[101 :db/ident :keyword/value2]}}
{:test/label ":db.cardinality/many, insert"
:test/assertions
[[:db/add 200 :db.schema/attribute 100]
[:db/add 200 :db.schema/attribute 101]]
:test/expected-transaction
#{[200 :db.schema/attribute 100 ?tx2 true]
[200 :db.schema/attribute 101 ?tx2 true]
[?tx2 :db/txInstant ?ms2 ?tx2 true]}
:test/expected-datoms
#{[100 :db/ident :keyword/value1]
[101 :db/ident :keyword/value2]
[200 :db.schema/attribute 100]
[200 :db.schema/attribute 101]}}
{:test/label ":db.cardinality/one, replace"
:test/assertions
[[:db/add 100 :db/ident :keyword/value11]
[:db/add 101 :db/ident :keyword/value22]]
:test/expected-transaction
#{[100 :db/ident :keyword/value1 ?tx3 false]
[100 :db/ident :keyword/value11 ?tx3 true]
[101 :db/ident :keyword/value2 ?tx3 false]
[101 :db/ident :keyword/value22 ?tx3 true]
[?tx3 :db/txInstant ?ms3 ?tx3 true]}
:test/expected-datoms
#{[100 :db/ident :keyword/value11]
[101 :db/ident :keyword/value22]
[200 :db.schema/attribute 100]
[200 :db.schema/attribute 101]}}
{:test/label ":db.cardinality/one, already present"
:test/assertions
[[:db/add 100 :db/ident :keyword/value11]
[:db/add 101 :db/ident :keyword/value22]]
:test/expected-transaction
#{[?tx4 :db/txInstant ?ms4 ?tx4 true]}
:test/expected-datoms
#{[100 :db/ident :keyword/value11]
[101 :db/ident :keyword/value22]
[200 :db.schema/attribute 100]
[200 :db.schema/attribute 101]}}
{:test/label ":db.cardinality/many, already present"
:test/assertions
[[:db/add 200 :db.schema/attribute 100]
[:db/add 200 :db.schema/attribute 101]]
:test/expected-transaction
#{[?tx5 :db/txInstant ?ms5 ?tx5 true]}
:test/expected-datoms
#{[100 :db/ident :keyword/value11]
[101 :db/ident :keyword/value22]
[200 :db.schema/attribute 100]
[200 :db.schema/attribute 101]}}
]