* Add tests for markdown-clj and tools.namespace
See comment for why only one markdown test could be run.
Closes #1069 and #1064
* Convert 10 test libs using add-libtest
Also improved add-libtest to only require maven artifact
and rely on clojars for getting git-url most of the time
* Convert 8 more test libs using add-libtest
Also updated table and added comment for newline test
* Fix doric test
* Disable tools.namespace test that fails on windows
* Added dozen manual test libs and converted 2 test libs
add-libtest.clj supports manually-added and test-directories options
* Converts last tests to test namespaces and write libraries.csv
* Add a number of library tests from projects.md
Also add more docs around adding test libs and tweak add script
* Use :sha for gitlib and older clojure cli
* Revert "Use :sha for gitlib and older clojure cli"
This reverts commit c663ab8368.
* Fix and disable failing tests
Disabled tests that fail consistently and fixed windows one
45 lines
1.6 KiB
Clojure
45 lines
1.6 KiB
Clojure
(ns contajners.impl-test
|
|
(:require
|
|
[clojure.test :as t]
|
|
[contajners.impl :as impl]))
|
|
|
|
(t/deftest meta-cleanup
|
|
(t/testing "remove internal namespace"
|
|
(t/is (= [:foo]
|
|
(impl/remove-internal-meta [:contajners/foo :foo])))))
|
|
|
|
(t/deftest param-gathering
|
|
(t/testing "gathering params as header query and path"
|
|
(t/is (= {:header {:a 1 :b 2}
|
|
:query {:c 3 :d 4}
|
|
:path {:e 5 :f 6}}
|
|
(reduce (partial impl/gather-params {:a 1 :b 2 :c 3 :d 4 :e 5 :f 6})
|
|
{}
|
|
[{:name "a" :in :header}
|
|
{:name "b" :in :header}
|
|
{:name "c" :in :query}
|
|
{:name "d" :in :query}
|
|
{:name "e" :in :path}
|
|
{:name "f" :in :path}])))))
|
|
|
|
(t/deftest body-serialization
|
|
(t/testing "body serialization when a map"
|
|
(t/is (= {:headers {"content-type" "application/json"}
|
|
:body "{\"a\":42}"}
|
|
(impl/maybe-serialize-body {:body {:a 42}}))))
|
|
(t/testing "body serialization when not a map"
|
|
(t/is (= {:body "yes"}
|
|
(impl/maybe-serialize-body {:body "yes"})))))
|
|
|
|
(t/deftest path-interpolation
|
|
(t/testing "path interpolation"
|
|
(t/is (= "/a/{w}/b/41/42"
|
|
(impl/interpolate-path "/a/{w}/b/{x}/{y}" {:x 41 :y 42 :z 43})))))
|
|
|
|
(t/deftest json-parsing
|
|
(t/testing "successful json parsing"
|
|
(t/is (= {:a 42}
|
|
(impl/try-json-parse "{\"a\":42}"))))
|
|
(t/testing "failed json parsing"
|
|
(t/is (= "yes"
|
|
(impl/try-json-parse "yes")))))
|