-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix spec to argslist translation (#701)
* Fix spec to argslist translation. * Remove redundant test case. * Remove unused spec namespace.
- Loading branch information
Showing
2 changed files
with
42 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(ns datahike.test.specification-test | ||
(:require | ||
#?(:cljs [cljs.test :as t :refer-macros [is are deftest testing]] | ||
:clj [clojure.test :as t :refer [is are deftest testing]]) | ||
[datahike.api.specification :refer [spec-args->argslist]])) | ||
|
||
(deftest spec-to-argslist-translation | ||
(testing "Testing core cases of spec to argslist translator." | ||
(is (= (spec-args->argslist '(s/alt :config (s/cat :config spec/SConfig) | ||
:nil (s/cat))) | ||
'[[config] []])) | ||
|
||
(is (= (spec-args->argslist '(s/cat :conn spec/SConnection :txs spec/STransactions)) | ||
'[[conn txs]])) | ||
|
||
(is (= (spec-args->argslist '(s/alt :argmap (s/cat :map spec/SQueryArgs) | ||
:with-params (s/cat :q (s/or :vec vector? :map map?) :args (s/* any?)))) | ||
'[[map] [q & args]])) | ||
|
||
(is (= (spec-args->argslist '(s/alt :simple (s/cat :db spec/SDB :opts spec/SPullOptions) | ||
:full (s/cat :db spec/SDB :selector coll? :eid spec/SEId))) | ||
'[[db opts] [db selector eid]])))) |