Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge `add-document` and `add-documents` tests.

  • Loading branch information...
commit 2db281ff7859ec52f72edde56163d5a6e2af2f8c 1 parent 2c86b14
@fracek authored
Showing with 13 additions and 11 deletions.
  1. +13 −11 test/indextank_clj/core_test.clj
View
24 test/indextank_clj/core_test.clj
@@ -26,7 +26,7 @@
(defn handler [req]
(pp/pprint req)
- (println)
+ (println) (println)
(condp = [(:request-method req) (:uri req)]
[:get "/v1/indexes/blog"] {:stauts 200 :body (json-str blog-index)}
[:get "/v1/indexes"] {:status 200 :body (json-str my-indexes)}
@@ -85,18 +85,20 @@
;; add-document test
(deftest test-add-document
(run-server)
- (let [resp (core/with-client localurl (core/add-document "blog" blog-post1))]
+ (let [resp (core/with-client localurl (core/add-document "blog" blog-post1))
+ resp-multi (core/with-client localurl
+ (core/add-document "forum" forum-posts))]
(is (true? resp))
- (is (thrown? Exception (core/with-client localurl
+ (is (thrown? IllegalArgumentException (core/with-client localurl
(core/add-document "blog" {:docid "p2"}))))
- (is (thrown? Exception (core/with-client localurl
- (core/add-document "blog" {:fields {:a "b"}}))))))
-;; add-documents test
-(deftest test-add-documents
- (run-server)
- (let [resp (core/with-client localurl
- (core/add-documents "forum" forum-posts))]
- (is (vector? resp))))
+ (is (thrown? IllegalArgumentException (core/with-client localurl
+ (core/add-document "blog" {:fields {:a "b"}}))))
+ (is (vector? resp-multi))
+ (is (every? :added resp-multi))
+ (is (thrown? IllegalArgumentException (core/with-client localurl
+ (core/add-document "blog"
+ [{:docid "p4"}
+ {:fields {}}]))))))
;; delete-document test
(deftest test-delete-document
Please sign in to comment.
Something went wrong with that request. Please try again.