Skip to content

Commit

Permalink
Add unit test for fetch-by-ids.
Browse files Browse the repository at this point in the history
  • Loading branch information
seancorfield committed Dec 17, 2011
1 parent 78a578d commit 66c4300
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/somnium/test/congomongo.clj
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@
(is (= "Stone" (:val (fetch-by-id :by-id "Blarney"))))
(is (= "warriors" (:val (fetch-by-id :by-id 300))))))

(deftest fetch-by-ids-of-any-type
(with-test-mongo
(insert! :by-ids {:_id "Blarney" :val "Stone"})
(insert! :by-ids {:_id 300 :val "warriors"})
(is (= #{"Stone" "warriors"} (set (map :val (fetch-by-ids :by-ids ["Blarney" 300])))))))

(deftest eager-ref-fetching
(let [fetch-eagerly (with-ref-fetching fetch)
fetch-eagerly-by-id (with-ref-fetching fetch-by-id)
Expand Down

0 comments on commit 66c4300

Please sign in to comment.