This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-16
Channels
- # beginners (7)
- # boot (63)
- # capetown (1)
- # cider (20)
- # clara (15)
- # cljs-dev (5)
- # clojure (195)
- # clojure-austria (2)
- # clojure-dev (46)
- # clojure-dusseldorf (9)
- # clojure-germany (6)
- # clojure-greece (36)
- # clojure-italy (5)
- # clojure-nl (4)
- # clojure-russia (173)
- # clojure-sg (1)
- # clojure-spec (93)
- # clojure-uk (65)
- # clojure-ukraine (2)
- # clojured (9)
- # clojureremote (1)
- # clojurescript (52)
- # core-async (14)
- # core-logic (5)
- # cursive (21)
- # data-science (8)
- # datomic (60)
- # emacs (83)
- # jobs (9)
- # jobs-discuss (7)
- # juxt (6)
- # klipse (2)
- # leiningen (1)
- # lumo (24)
- # mount (4)
- # numerical-computing (1)
- # off-topic (18)
- # om (37)
- # om-next (5)
- # onyx (13)
- # pedestal (1)
- # perun (44)
- # proton (2)
- # rdf (3)
- # re-frame (24)
- # reagent (4)
- # remote-jobs (3)
- # spacemacs (3)
- # testing (6)
- # vim (10)
- # yada (2)
@surreal.analysis 1) in the future you still might want to optimize the test suite and run tests in parallel using all the cores, e.g. using https://github.com/weavejester/eftest runner instead of lein test
.
2) the described approach probably goes against the rule of "Don't mock code you don't own". Here's a nice summary about this rule of thumb: https://github.com/mockito/mockito/wiki/How-to-write-good-tests#dont-mock-type-you-dont-own
@metametadata Thanks for more insight. In this case, I think mocking might still be the best case, because all I’m doing is adding a sleep statement. That is, it’s async code that interacts with JavaScript in a running web browser. We have no way of knowing when the code is complete, and some timing issues were present in production that aren’t present on my machine. By adding a single test that made the execute-javascript
function execute the first part, then sleep for awhile, I could reproduce the issue and add a failing case that I then fixed
I’d strongly recommend never, ever using sleeps to make async things pass in tests
put something in the mock that you can join on, e.g. deref a promise
In this case it looks like it was impossible because the tested implementation also doesn't use any callbacks/promises/etc.. But I'm not sure I correctly understood the scenario.