Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix upsert eav with nil value #7

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)))))
Loading