-
Notifications
You must be signed in to change notification settings - Fork 42
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
Store/Coordinator test support. #155
Comments
IMHO any new test helpers should target the new QUnit testing APIs since they are massively easier to deal with |
I also ended up having to close the IDB connection when the Ember Application is being torn down import IndexedDBSource from '@orbit/indexeddb';
export default {
create(injections = {}) {
injections.name = 'backup';
injections.namespace = 'smart-shopping-list';
let source = new IndexedDBSource(injections);
source.destroy = function() {
return this.closeDB();
};
return source;
}
}; |
@martndemus Apologies for a delayed response. I really appreciate your exploration here and support shipping test helpers as needed 💯
@Turbo87 yeah, that is optimal 👍
@martndemus Makes sense. We should collect testing tips per source and include them in the right package in the main orbit repo. Ideally we can reference these from ember-orbit to minimize duplication. |
@dgeb Thanks so much for this addon. I have backup/remote sources working as expected, but am having trouble fixing my previous acceptance tests (which use the newer test helpers and other popular testing addons e.g. ember-cli-mirage). Are there any other docs/example apps that showcase how to integrate this with a newer app's test suite? |
I'm also curious about the testing story here. It would be awesome to get things working with mirage or something similar. |
I've been hacking around with setting up and tearing down Orbit around (acceptance) tests. More specifically I'm building a demo app that only use IDB as backup and no remote JSON:API source.
To be able to access the store in an acceptance context I had to manually construct the whole store within the
moduleForAcceptance
helper.The second thing is that it looks like when using Orbit's store like that, the acceptance test helpers don't pickup on the Promises that Orbit's actions create, so it will just not wait for them. I had to create a simple
waitFor
async helper that takes Orbit's promises and queues them up properly.What I'm alluding to is that it would be awesome if Ember-Orbit contained a few test helpers that stream lines the test experience.
Below is part of the Orbit setup I wrote for the tests:
example acceptance test
tests/helpers/module-for-acceptance.js
tests/helpers/create-orbit-store.js
tests/helpers/wait-for.js
The text was updated successfully, but these errors were encountered: