-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
If I have multiple 'run-sync!'s in my test, the second one doesn't seem to update state until after a small amount of time. The following is just an example, but if I need to put together a sample app that duplicates this weirdness I can.
If I have:
(deftest test-thing
(let [app (app/build dataflow-description)
app-model (render/consume-app-model app (constantly nil))]
(app/begin app)
(testing "app model test"
(is (test/run-sync! app [{msg/type :set-value msg/topic [:some :path] :value "thing"}
{msg/type :set-value msg/topic [:some :other :path] :value "blah"}]))
(is (= (q '[:find ?v
:where
[?n :t/path [:affected :path]]
[?n :t/value ?v]]
@app-model)
[["maybe some derived thing"]])))
(testing "look in data model"
(is (test/run-sync! app [{msg/type :set-value msg/topic [:some :path] :value nil}]))
(is (nil? (-> app :state deref :data-model :some :path))))))The last is assertion in will fail.
If I eliminate the first testing form (and therefore remove the first call to run-sync!), the last is will pass!
Even weirder, if I simply add a (Thread/sleep 100), leaving the first testing form, before the last is, it will pass!
Any ideas?
Reactions are currently unavailable