Commits

shantanuk  committed 3b35e55

add unit test for lazy find-xxx functions

  • Participants
  • Parent commits 9f053ed

Comments (0)

Files changed (1)

File src/test/clj/org/bituf/sqlrat/test/dbblog.clj

         (is (nil? en))
         (println "\nRow 11 (non-existent):" en)
         (is (= 3 (count ea)))
-        (ppe "\nAll rows:" ea)))))
+        (ppe "\nAll rows:" ea))
+      (with-find-by-criteria-results rows blog-entry-meta {}
+        (let [all (into [] rows)]
+          (is (= 3 (count all)))
+          (ppe "##with-find-by-criteria-results##" all))))))
 
 
 (deftest test-populate-comment-table
             r (s e)]
         (is (= 1 (count r)))
         (ppe "\nEntry:" [e])
-        (ppe "\nRelations:" r))
+        (ppe "\nRelations:" r)
+        ;; lazy-version
+        (with-find-rels-results res [e] entry-comment-meta {}
+          (let [all (into [] res)]
+            (is (= 1 (count all))))))
       (let [e  (find-by-id blog-entry-meta 2)
             r  ((find-entity-rels-map [e] entry-comment-meta) e)
             rc ((find-entity-rels-map [e] entry-comment-meta
         (ppe "\nSiblings:" s)
         (ppe "\nSiblings with selected columns:" sc)
         (ppe "\nSiblings with WHERE clause:" sw)
-        (ppe "\nSiblings with selected columns and WHERE clause:" sb)))))
+        (ppe "\nSiblings with selected columns and WHERE clause:" sb)
+        ;; lazy version
+        (with-find-siblings-results ses c blog-entry-meta {}
+          (let [all (into [] ses)]
+            (is (= 2 (count ses)))))))))
 
 
 (deftest test-count-function