Skip to content
Snippets Groups Projects
Commit bbbf86e3 authored by Cam Saül's avatar Cam Saül
Browse files

Oh actually there were tests. Move them over :broken_heart:

parent 08740c1b
No related branches found
No related tags found
No related merge requests found
......@@ -36,3 +36,22 @@
(expect
:type/*
(driver/values->base-type [(Object.)]))
;; Should work with initial nils even if sequence is lazy
(expect
[:type/Integer true]
(let [realized-lazy-seq? (atom false)]
[(driver/values->base-type (lazy-cat [nil nil nil]
(do (reset! realized-lazy-seq? true)
[4 5 6])))
@realized-lazy-seq?]))
;; but it should respect laziness and not keep scanning after it finds 100 values
(expect
[:type/Integer false]
(let [realized-lazy-seq? (atom false)]
[(driver/values->base-type (lazy-cat [1 2 3]
(repeat 1000 nil)
(do (reset! realized-lazy-seq? true)
[4 5 6])))
@realized-lazy-seq?]))
......@@ -3,36 +3,7 @@
[metabase.test.util :as tu]))
(tu/resolve-private-vars metabase.query-processor.middleware.annotate-and-sort
vals->base-type infer-column-types)
;; tests for vals->base-type
(expect
:type/Integer
(vals->base-type [1 "A" "B"]))
;; should work with some initial nils
(expect
:type/Text
(vals->base-type [nil nil "A"]))
;; (even if sequence is lazy)
(expect
[:type/Integer true]
(let [realized-lazy-seq? (atom false)]
[(vals->base-type (lazy-cat [nil nil nil]
(do (reset! realized-lazy-seq? true)
[4 5 6])))
@realized-lazy-seq?]))
;; but it should respect laziness and not keep scanning after it finds the first non-`nil` value
(expect
[:type/Integer false]
(let [realized-lazy-seq? (atom false)]
[(vals->base-type (lazy-cat [1 2 3]
(do (reset! realized-lazy-seq? true)
[4 5 6])))
@realized-lazy-seq?]))
infer-column-types)
;; make sure that `infer-column-types` can still infer types even if the initial value(s) are `nil` (#4256)
(expect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment