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

support query-string t val in from, from-named #56

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{:deps {org.clojure/clojure {:mvn/version "1.11.2"}
org.clojure/core.async {:mvn/version "1.6.681"}
com.fluree/db {:git/url "https://github.com/fluree/db.git"
:git/sha "478c4fe92bbc28691d331bff72243618aa067a46"}
:git/sha "050e230e26be5edc933bd3db823ffa029ec0ac70"}
com.fluree/json-ld {:git/url "https://github.com/fluree/json-ld.git"
:git/sha "0958995acf5540271d1807fc6d8f2da131164e24"}

Expand Down
45 changes: 45 additions & 0 deletions test/fluree/server/integration/basic_transaction_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,51 @@
(is (= {"ledger" ledger-name, "t" 2}
(-> res :body json/read-value (select-keys ["ledger" "t"])))))))

(deftest ^:integration ^:json transaction-with-dbs-at-multiple-t-values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test could use more English commentary through more nested testing macros and/or using the third, msg argument of the is macro.

(testing "can transact with a where clause"
(let [ledger-name (create-rand-ledger "transact-endpoint-multi-ledger")
req1 (json/write-value-as-string
{"@context" test-system/default-context
"ledger" ledger-name
"insert" {"id" "ex:transaction-test"
"type" "schema:Test"
"ex:name" "transact-endpoint-json-test"}})
res1 (api-post :transact {:body req1, :headers json-headers})
_ (assert (= 200 (:status res1)))
req2 (json/write-value-as-string
{"@context" test-system/default-context
"ledger" ledger-name
"insert" {"id" "?t"
"ex:name" "new-name"}
"delete" {"id" "?t"
"ex:name" "transact-endpoint-json-test"}
"where" {"id" "?t", "type" "schema:Test"}})
res2 (api-post :transact {:body req2, :headers json-headers})]
(is (= 200 (:status res2)))
(is (= [{"id" "ex:transaction-test"
"type" "schema:Test"
"ex:name" "new-name"}]
(->> {:body (json/write-value-as-string
{"@context" test-system/default-context
"select" {"ex:transaction-test" ["*"]}
"from" ledger-name})
:headers json-headers}
(api-post :query)
:body
json/read-value)))

(is (= [{"id" "ex:transaction-test"
"type" "schema:Test"
"ex:name" "transact-endpoint-json-test"}]
(->> {:body (json/write-value-as-string
{"@context" test-system/default-context
"select" {"ex:transaction-test" ["*"]}
"from" (str ledger-name "?t=2")})
:headers json-headers}
(api-post :query)
:body
json/read-value))))))

(deftest ^:integration ^:json transaction-with-where-clause-test
(testing "can transact with a where clause"
(let [ledger-name (create-rand-ledger "transact-endpoint-json-test")
Expand Down