reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

Unit test failures #147

Open cloojure opened 6 years ago

cloojure commented 6 years ago

Hi - I got the unit tests to run with phantom & java 8, but had 11 test failures. Am I missing something? Alan


~/gh/reagent-forms > lein clean; lein doo phantom test once

;; ======================================================================
;; Testing with Phantom:

Testing reagent-forms.core-test

FAIL in (set-attrs-test) (:)
Attrs are cleaned.
expected: (= (core/set-attrs div {}) [:div {:random-attr :random-attr} "body"])
  actual: (not (= [:div {:visible? :visible?, :fmt :fmt, :postamble :postamble, :field :field, :date-format :date-format, :preamble :preamble, :event :event, :auto-close? :auto-close?, :save-fn :save-fn, :random-attr :random-attr, :inline :inline} "body"] [:div {:random-attr :random-attr} "body"]))

FAIL in (set-attrs-test) (:)
Opts are binded.
expected: (= (core/set-attrs div {:get :get, :save! :save}) [:div {:random-attr :random-attr, :get :get, :save! :save} "body"])
  actual: (not (= [:div {:visible? :visible?, :get :get, :fmt :fmt, :postamble :postamble, :field :field, :date-format :date-format, :preamble :preamble, :event :event, :save! :save, :auto-close? :auto-close?, :save-fn :save-fn, :random-attr :random-attr, :inline :inline} "body"] [:div {:random-attr :random-attr, :get :get, :save! :save} "body"]))

FAIL in (set-attrs-test) (:)
Default attributes are applied.
expected: (= (core/set-attrs div {} {:default-attr :default-attr}) [:div {:random-attr :random-attr, :default-attr :default-attr} "body"])
  actual: (not (= [:div {:visible? :visible?, :fmt :fmt, :postamble :postamble, :field :field, :date-format :date-format, :preamble :preamble, :event :event, :auto-close? :auto-close?, :save-fn :save-fn, :random-attr :random-attr, :default-attr :default-attr, :inline :inline} "body"] [:div {:random-attr :random-attr, :default-attr :default-attr} "body"]))

FAIL in (init-field-test) (:)
expected: (= component [:div.btn-group {:field :single-select, :id :selected} [:button.btn.btn-default {:key :left} "Left"] [:button.btn.btn-default {:key :middle} "Middle"] [:button.btn.btn-default {:key :right} "Right"]])
  actual: (not (= [:div.btn-group {:id :selected} [:button.btn.btn-default {:key :left} "Left"] [:button.btn.btn-default {:key :middle} "Middle"] [:button.btn.btn-default {:key :right} "Right"]] [:div.btn-group {:field :single-select, :id :selected} [:button.btn.btn-default {:key :left} "Left"] [:button.btn.btn-default {:key :middle} "Middle"] [:button.btn.btn-default {:key :right} "Right"]]))

FAIL in (init-field-test) (:)
expected: (= (dissoc-fns comp) [:div {:valid? :id, :class "some-text"} "body"])
  actual: (not (= [:div {:valid? :id} "body"] [:div {:valid? :id, :class "some-text"} "body"]))

FAIL in (init-field-test) (:)
expected: (let [comp ((core/init-field [:div {:field :container, :valid? :id} "body"] {:doc (atom {:id "some-text"}), :get (fn [kw] (when kw (kw {:id "some-text"}))), :save! (fn [& _]), :update! (fn [[& _]])}))] (is (= (dissoc-fns comp) [:div {:valid? :id, :class "some-text"} "body"])))
  actual: false

FAIL in (init-field-test) (:)
expected: (= (dissoc-fns comp) [:input {:type :text, :value nil}])
  actual: (not (= [:input {:type :number, :value nil}] [:input {:type :text, :value nil}]))

FAIL in (init-field-test) (:)
expected: (let [comp ((core/init-field [:input {:field :numeric}] {:doc (atom {}), :get (fn [kw] (when kw (kw {}))), :save! (fn [& _]), :update! (fn [[& _]])}))] (is (= (dissoc-fns comp) [:input {:type :text, :value nil}])))
  actual: false

FAIL in (bind-fields-test) (:)
:doc is associated with :get when map is passed.
expected: (= opts {:doc :get, :get :get, :save! :save!, :update! :update!})
  actual: (not (= {:doc nil, :get #object[Function], :save! #object[Function], :update! #object[Function]} {:doc :get, :get :get, :save! :save!, :update! :update!}))

FAIL in (bind-fields-test) (:)
:doc is associated with :get when map is passed.
expected: (= opts {:doc :get, :get :get, :save! :save!, :update! :update!})
  actual: (not (= {:doc nil, :get #object[Function], :save! #object[Function], :update! #object[Function]} {:doc :get, :get :get, :save! :save!, :update! :update!}))

FAIL in (bind-fields-test) (:)
:doc is associated with :get when map is passed.
expected: (= opts {:doc :get, :get :get, :save! :save!, :update! :update!})
  actual: (not (= {:doc nil, :get #object[Function], :save! #object[Function], :update! #object[Function]} {:doc :get, :get :get, :save! :save!, :update! :update!}))

Ran 13 tests containing 75 assertions.
11 failures, 0 errors.
Subprocess failed
yogthos commented 6 years ago

Hmm nothing jumps out at me. I actually get an exception locally with JDK 1.8.0_163:

Caused by: clojure.lang.ExceptionInfo: Wrong number of args (1) passed to: nodes/ranges at line 25 out/clojure/core/rrb_vector/trees.cljs {:file "out/clojure/core/rrb_vector/trees.cljs", :line 25, :column 24, :tag :cljs/analysis-error}
cloojure commented 6 years ago

I get the same errors with the newer deps on clojure 1.9/java 10 (running on Ubuntu 16.04)

cloojure commented 6 years ago
~/gh/reagent-forms > uname -a
Linux brandy 4.4.0-122-generic #146-Ubuntu SMP Mon Apr 23 15:34:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

~/gh/reagent-forms > lsb_release -a
LSB Version:    core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:    16.04
Codename:   xenial

~/gh/reagent-forms > 
~/gh/reagent-forms > java --version
java 10 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)

~/gh/reagent-forms > lein --version
Leiningen 2.8.1 on Java 10 Java HotSpot(TM) 64-Bit Server VM
yogthos commented 6 years ago

The error doesn't appear to be related to anything in the project itself though.

yogthos commented 6 years ago

Ah looks like a known issue

yogthos commented 6 years ago

So looks like the best thing to do might be to roll back test dependencies to the older versions, doesn't look like it's possible to run tests otherwise.

cloojure commented 6 years ago

I'm confused.... Is the problem in rrb_vector or lein-cljsbuild?

On Wed, May 23, 2018 at 8:08 PM, Dmitri Sotnikov notifications@github.com wrote:

So looks like the best thing to do might be to roll back test dependencies to the older versions, doesn't look like it's possible to run tests otherwise.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/reagent-project/reagent-forms/issues/147#issuecomment-391573522, or mute the thread https://github.com/notifications/unsubscribe-auth/AGwXB-VksfJ37IQXQhvPdN7LViGlp5Gnks5t1iQRgaJpZM4ULd2z .

yogthos commented 6 years ago

It looks like it needs to be addressed in lein-cljsbuild

miikka commented 5 years ago

Doo does not use lein-cljsbuild for building even though it reads the :cljsbuild key in project.clj. Which is to say that the same problem might need to be fixed in Doo as well. I'm unable to reproduce this problem myself with Doo, but if you know how to do it, please open an issue in Doo.

(edit: okay, i was able to reproduce it myself after all.)