Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird 'run-sync!' behavior #12

Open
avescodes opened this issue Feb 14, 2014 · 0 comments
Open

Weird 'run-sync!' behavior #12

avescodes opened this issue Feb 14, 2014 · 0 comments
Labels

Comments

@avescodes
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant