Skip to content

Commit

Permalink
fix upsert eav with nil value
Browse files Browse the repository at this point in the history
  • Loading branch information
clyfe committed Dec 11, 2023
1 parent 20c607b commit 1681b7f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Changelog

### [Unreleased]
- fixed upsert eav with value nil

### [0.1.7] - 2018-05-05
#### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/clara_eav/dsl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
(symbol? %)))
(s/def ::a #(or (keyword? %)
(symbol? %)))
(s/def ::v some?)
(s/def ::v any?)

(s/def ::sexp list?)
(s/def ::bind symbol?)
Expand Down
2 changes: 1 addition & 1 deletion src/clara_eav/eav.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
(int? %)
(uuid? %)))
(s/def ::a keyword?)
(s/def ::v some?)
(s/def ::v any?)
(s/def ::record (s/and #(instance? EAV %)
(s/keys :req-un [::e ::a ::v])))
(s/def ::record-seq (s/coll-of ::record))
Expand Down
12 changes: 12 additions & 0 deletions test/clara_eav/rules_test.cljc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns clara-eav.rules-test
(:require [clara-eav.test-helper :as test-helper]
[clara-eav.eav :as eav]
#?@(:clj [[clara.rules :as rules]
[clara-eav.rules :as eav.rules]
[clojure.test :refer [deftest testing is are use-fixtures]]]
Expand Down Expand Up @@ -200,3 +201,14 @@
[] (transients session5)
store5s (:store session5)
tempids5s (:tempids session5))])))

(deftest upsert-nil-value
(testing "Upsert of eav with value nil"
(let [t {:eav/eid 1 :todo/text nil}
session1 (upsert session {:eav/eid 1 :todo/text nil})
session2 (upsert session (eav/->EAV 1 :todo/text nil))
session3 (upsert session [1 :todo/text nil])]
(are [x] (= t x)
(todo session1 1)
(todo session2 1)
(todo session3 1)))))

0 comments on commit 1681b7f

Please sign in to comment.