Giter Site home page Giter Site logo

untangled-spec's People

Contributors

awkay avatar egracer avatar jasonjckn avatar jdslavin avatar pancia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

untangled-spec's Issues

edn rendering seems to cause react warnings

Warning: React.createElement(...): Expected props argument to be a plain object.

printWarning	@	react.inc.js:20483
warning	@	react.inc.js:20507
ReactElement.createElement	@	react.inc.js:10609
createElement	@	react.inc.js:10950
om.dom.span.cljs$core$IFn$_invoke$arity$variadic	@	dom.cljs?rel=1480629449852:9
om$dom$span	@	dom.cljs?rel=1480629449852:9
untangled_spec$dom$edn_renderer$clearfix_separator_STAR_	@	edn_renderer.cljs?rel=1480629449980:25
(anonymous function)	@	edn_renderer.cljs?rel=1480629449980:34
cljs.core.repeatedly.cljs$core$IFn$_invoke$arity$1	@	core.cljs:4603
cljs.core.LazySeq.sval	@	core.cljs:3223
cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1	@	core.cljs:3277
cljs$core$seq	@	core.cljs:1107
cljs.core.interleave.cljs$core$IFn$_invoke$arity$2	@	core.cljs:4615
cljs.core.LazySeq.sval	@	core.cljs:3223
cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1	@	core.cljs:3277
cljs$core$seq	@	core.cljs:1107
cljs.core.Cons.cljs$core$INext$_next$arity$1	@	core.cljs:3065
cljs$core$next	@	core.cljs:1152
cljs$core$to_array	@	core.cljs:3445
untangled_spec$dom$edn_renderer$interpose_separator	@	edn_renderer.cljs?rel=1480629449980:33
untangled_spec$dom$edn_renderer$join_html	@	edn_renderer.cljs?rel=1480629449980:48
untangled_spec$dom$edn_renderer$html_collection	@	edn_renderer.cljs?rel=1480629449980:70
untangled_spec$dom$edn_renderer$html	@	edn_renderer.cljs?rel=1480629449980:95
untangled_spec.dom.edn_renderer.html_edn.cljs$core$IFn$_invoke$arity$variadic	@	edn_renderer.cljs?rel=1480629449980:122
untangled_spec$dom$edn_renderer$html_edn

Error rendering in untangled-client

TypeError cannot read property call of null in reconcile!, when trying to ((:render st))

Try:

  • def-test-suite should def renderer without genysm, but use the suite-name.
  • try js/timeout between mount & runner?

diff algorithm has bug

(untangled-spec.reporters.impl.diff/diff
        {:current-tab [:messages :tab], :ui/loading-data false}
        {:current-tab [:settings :tab], :ui/loading-data false})

evaluates to {}

expected {[:current-tab 0] [:+ :messages :- :settings]}

When mocking, failures should be a LOT more helpful

EX: Mocking a function with an => arrow, should report more than a vague error about it not being called the right number of times when it is actually called more than once but with incorrect number of arguments.

;; SRC
(defn foo [& xs] (first x)) 
;; TEST
(when-mocking
  (foo arg1) => arg1
  (assertions (do (foo 1) (foo 2 3)) => :what?))

Proposed error message should show the mock invocation history and therefore have more information about the failing case.

Assertions fails to diff a vector & a scalar (eg: number)

(assertions [1 2] => 3)

=>

core.cljs:5103 Uncaught Error: Vector's key for assoc must be a number.
cljs.core.PersistentVector.cljs$core$IAssociative$_assoc$arity$3	@	core.cljs:5103
cljs$core$_assoc	@	core.cljs:534
cljs.core.assoc.cljs$core$IFn$_invoke$arity$3	@	core.cljs:1860
cljs$core$assoc_in	@	core.cljs:4818
(anonymous function)	@	edn_renderer.cljs?rel=1480719314221:110
(anonymous function)	@	core.cljs:2314
cljs.core.seq_reduce.cljs$core$IFn$_invoke$arity$3	@	core.cljs:2314
cljs.core.PersistentArrayMap.cljs$core$IReduce$_reduce$arity$3	@	core.cljs:6282
cljs.core.reduce.cljs$core$IFn$_invoke$arity$3	@	core.cljs:2358
cljs$core$reduce	@	core.cljs:2329
untangled_spec$dom$edn_renderer$apply_diff	@	edn_renderer.cljs?rel=1480719314221:107
untangled_spec.dom.edn_renderer.html_edn.cljs$core$IFn$_invoke$arity$variadic	@	edn_renderer.cljs?rel=1480719314221:121
untangled_spec$dom$edn_renderer$html_edn	@	edn_renderer.cljs?rel=1480719314221:117

Refactor reporters & provided macros

  • Use clojure spec to parse mocking triples
  • Simplify & then merge report logic between browser & terminal
  • Spec reporting maps (eg: item, result, namespace)
  • Test reporting code

README instructions don't work for non-alpha version

The code example in 1.2: Clojure in the browser doesn't work with the latest non-alpha version (0.4.0) — untangled-spec.selectors and untangled-spec.suite don't exist in that version, so the :require clause fails. Since the latest version is currently an alpha, would it make sense to provide a corresponding version of the example for 0.4.0?

Use clojure spec from fdef when mocking

When mocking we should validate the return value based on a potential :ret spec on the function we are mocking.

NOTE: use s/get-spec on the var, eg: (-> sum var s/get-spec :ret (s/valid? ...))

NOTE: It may not be a function, as we may be supporting protocols &/or inline (& maybe others)

(s/fdef sum :ret number?)
(defn sum [& xs] (apply + xs))

(when-mocking
  (sum 0 1 2) => "3"
  ...)

;=> fails because it failed the sum :ret spec (not a number?)

Assertion EDN display crashes on nested lists

(assertions 
   "sample"
      `[({:prop []} {:n 1})] => `[({:prop []} {:n 2})])

crashes in 0.3.9

core.cljs:270 Uncaught Error: No protocol method IAssociative.-assoc defined for type cljs.core/Cons: ({:prop []} {:n 1})

Also getting a core.cljs:264 Uncaught Error: No protocol method IAssociative.-assoc defined for type cljs.core/IndexedSeq: (2 :evil)(…)
when testing something like ((fn [& args] args) 2 3) => [1 2] in the stub machinery.

Exception on compile: No such var: find/find-sources-in-dir, compiling:(clojure/tools/namespace/dir.clj:26:17)

Trying to do lein test-refresh, lein repl etc when requiring untangled-spec suite in my user namespace causes an exception. I don't use or require it anywhere else.

(ns user
   (:require
     [untangled-spec.suite :as suite]))
Exception in thread "main" java.lang.ExceptionInInitializerError
	at clojure.main.<clinit>(main.java:20)
Caused by: java.lang.RuntimeException: No such var: find/find-sources-in-dir, compiling:(clojure/tools/namespace/dir.clj:26:17)

My project.clj:

(defproject imperimetric "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.9.0-alpha14"]
                 [org.clojure/clojurescript "1.9.495"]
                 [reagent "0.6.0"]
                 [binaryage/devtools "0.8.3"]
                 [re-frame "0.9.1"]
                 [secretary "1.2.3"]
                 [cljs-ajax "0.5.8"]
                 [compojure "1.5.1"]
                 [instaparse "1.4.3"]
                 [liberator "0.14.1"]
                 [medley "0.8.4"]
                 [frinj "0.2.5"]
                 [cheshire "5.6.3"]
                 [yogthos/config "0.8"]
                 [cljsjs/clipboard "1.5.13-0"]
                 [ring "1.5.0"]
                 [ring/ring-mock "0.3.0"]
                 [org.clojure/tools.namespace "0.3.0-alpha3"]
                 [devcards "0.2.2"]]

  :uberjar-name "imperimetric-standalone.jar"

  :plugins [[lein-cljsbuild "1.1.5"]
            [lein-less "1.7.5"]
            [lein-kibit "0.1.3"]]

  :min-lein-version "2.5.3"

  :source-paths ["src/clj"]

  :clean-targets ^{:protect false} ["resources/public/js/compiled" "target"
                                    "test/js"]

  :figwheel {:css-dirs         ["resources/public/css"]
             :nrepl-host       "0.0.0.0"
             :nrepl-port       7888
             :nrepl-middleware ["cemerick.piggieback/wrap-cljs-repl"]}

  :less {:source-paths ["less"]
         :target-path  "resources/public/css"}

  :hooks [leiningen.less]

  :profiles
  {:dev
   {:dependencies [[pjstadig/humane-test-output "0.8.1"]
                   [figwheel-sidecar "0.5.0"]
                   [com.cemerick/piggieback "0.2.1"]
                   [org.clojure/test.check "0.9.0"]
                   [navis/untangled-spec "1.0.0-alpha3"]]
    :plugins      [[lein-figwheel "0.5.4-3"]
                   [lein-doo "0.1.7"]
                   [com.jakemccrary/lein-test-refresh "0.19.0"]]
    }}

  :uberjar {:aot :all}

  :cljsbuild
  {:builds
   [{:id           "dev"
     :source-paths ["src/cljs"]
     :figwheel     {:on-jsload "imperimetric.core/mount-root"}
     :compiler     {:main                 imperimetric.core
                    :output-to            "resources/public/js/compiled/app.js"
                    :output-dir           "resources/public/js/compiled/out"
                    :asset-path           "js/compiled/out"
                    :source-map-timestamp true}}
    {:id           "min"
     :source-paths ["src/cljs"]
     :jar          true
     :compiler     {:main            imperimetric.core
                    :output-to       "resources/public/js/compiled/app.js"
                    :optimizations   :advanced
                    :closure-defines {goog.DEBUG false}
                    :pretty-print    false}}
    {:id           "devcards"
     :source-paths ["src/devcards" "src/cljs"]
     :figwheel     {:devcards true}
     :compiler     {:main                 imperimetric.core-card
                    :output-to            "resources/public/js/compiled/devcards.js"
                    :output-dir           "resources/public/js/compiled/devcards_out"
                    :asset-path           "js/compiled/devcards_out"
                    :source-map-timestamp true}}
    {:id           "test"
     :source-paths ["src/cljs" "test/cljs"]
     :compiler     {:output-to     "resources/public/js/compiled/test.js"
                    :main          imperimetric.runner
                    :optimizations :none}}
    ]}

  :main imperimetric.server

  :aot [imperimetric.server]

  :prep-tasks [["cljsbuild" "once" "min"] "compile"]
  )


Cannot seem to find what the issue is, I'm assuming the issue is not with tools.namespace itself.

Provide description of the project plz

It's much easier, when project has description and you can fast understand purpose.
And it's a little bit sad, when "No description or website provided." appears.
Anyway, great work guys

diff algorithm has (another) bug

[untangled-spec.reporters.impl.diff :refer [diff]]

                 (diff {:current-tab [:bookings :tab],
                        :search-results {:global {:es-type "booking"}}}
                       {:current-tab [:messages :tab],
                        :search-results {:global {:es-type "message"}}})

evaluates to

                 {[:search-results :global :es-type] [:+ "booking" :- "message"]}

tested on 0.3.8

Add way to debug print (ie like do-report or print)

So it shows up near the test reporting, so we can debug easier than just printing and having them bunch up at the top with no clear way to tell where it came from.

Maybe just a with-out-str? Try to solve issue #13 first?

Reporting seems broken when using deftest and untangled-spec

(ns spec-playground.core-test
  (:require
    [clojure.test :as t]
    [spec-playground.core :refer :all]
    [untangled-spec.core :refer [specification behavior component assertions]]))

(t/deftest a-test
  (t/testing "FIXME, I fail."
    (t/is (= 2 1) "AMLAKDF")))

(specification "arithmetic"
  (component "addition"
    (behavior "is commutative"
      (assertions
        (+ 13 42) => (+ 42 13)))))

Results in the following outline

*********************************************
*************** Running tests ***************
:reloading (spec-playground.core-test)
Running tests for: (spec-playground.core-test)

Testing spec-playground.core-test ;; FAILING
   arithmetic ;; PASSING
     addition ;; PASSING
       is commutative ;; PASSING

Ran 2 tests containing 2 assertions.
1 failures, 0 errors.

Failed 1 of 2 assertions
Finished at 11:33:56.296 (run time: 0.027s)

matches? helper for asserting facts in a =fn=>

(some-response) =fn=> (matches? {:status 200, :body file?})

Creates a fn that takes a value and checks it against a spec,
values in the spec become like a =>, if it's a it's like a =fn=>, etc...

Render server tests through the browser

Merge the rendering, split the running of tests so that we just send data to the renderer about the test results.

  • Backwards compatibility (eg: terminal, console, & suite)
    • Terminal reporting incorrectly always saying "passed all tests"
  • Compilation and unexpected errors should be properly reported (& NOT crash everything)
    • serialize throwable in untangled websockets make-channel-server
    • serialize regex?
    • report better when transit serialization fails in websocket push
  • Must work once jar'ed
  • Selector toggle menu
    • functionality
    • ui
    • figwheel reload ignores/wipes current selectors
  • Tests for uncaught errors in all the macros & especially im/try-report
  • docstrings, readme, cookbook, devguide, etc...

See develop...experimental/rendering-merge previously (unlinked) commits.

broken assertions conform with multiple behavior strings

(s/def ::thing (s/cat :a (s/? string?) :b (s/+ number?))) 
(s/def ::seq-of (s/+ ::thing))

(s/conform ::seq-of (list ”foo” 1 “bar” 2 3 “qux” 4)) 
;=> [{:a "foo", :b [1]} [{:a "bar", :b [2 3]} {:a "qux", :b [4]}]]

;EXPECTED 
;=> [{:a "foo", :b [1]} {:a "bar", :b [2 3]} {:a "qux", :b [4]}]

;; ONLY 2nd thing matters? 
(s/conform ::seq-of (list ”foo” 1 2 “bar" 3)) 
;=> [{:a "foo", :b [1 2]} {:a "bar", :b [2]}]

;; NO OPTIONAL 
(s/def ::thing (s/cat :a string? :b (s/+ number?))) 
(s/def ::seq-of (s/+ ::thing))
(s/conform ::seq-of (list ”foo” 1 “bar” 2 3 “qux” 4)) 
;=> [{:a "foo", :b [1]} {:a "bar", :b [2 3]} {:a "qux", :b [4]}] 

This also only shows up if there are 2+ numbers in the 2nd or later ::thing
AND the problem goes away if I make :a not optional…

is this at all related to http://dev.clojure.org/jira/browse/CLJ-2003 ?

POSTED TO: http://dev.clojure.org/jira/browse/CLJ-2105

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.