Closed dustinfarris closed 7 years ago
so my test was failing because i was failing to clear cashay between tests.
looks like the Ember.run i have in the redux subscribe callback is good enough.
Possibly will need to hook into callbacks in the future, but that day is not today.
I am hitting a scenario where the async nature of Cashay is causing test errors.
This is because Ember implements a run-loop to manage tasks and optimize scheduling where possible.
While run-loops are auto-created as needed in production, the run-loop is disabled in testing—to help discover patches of code not covered so you can fix them.
A common sore spot is with async third-party libs that do not cater to this Ember-specific detail—such as Cashay.
tl;dr my assertions run before cashay.query is done handling results from a server query.
So this is a selfish (Ember-specific) request: I need a way to wrap the code that happens after
await transport.handleQuery
here and here. If these sections of code could be moved to separate callback functions that I can import, wrap, and give back tocashay.create
my problems should go away.For me this would look something like:
I don't think this would be a breaking change if the arg to .create is just tacked on the end with the proper default.
I am willing to do the work here, but @mattkrick is this ok with you?