-
Notifications
You must be signed in to change notification settings - Fork 76
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
Empty store after tests #217
Comments
The stack traces on these errors are incredibly frustrating; in my case I believe the issue was an unhandled rejection in a promise chain saving a pouch record. Almost all rejections related to ember-pouch, in my limited experience, are 409 conflicts. Can you add a catch to your |
Hi @Matt-Jensen, i've tried that but the catch never runs, i've tried everything that i could think of, even creating a new db for each test, the worse part is that sometimes the tests run fine and sometimes the error occurs 😩, i don't even know how to reproduce it reliably, the records are always deleted so the code works anyway |
Can you try with the new ember-pouch version 5.1.0? This one has some new behavior for deletes. Otherwise I think the best way is to use a memory adapter for tests. If you then make sure that each test will create a separate app you should be set. To be able to use the memory adapter you'll have to load the file, as it is not added by default. If you are not using ember-auto-import you can use ember-cli-build.js to add the file to the vendorTree and import it.
Then setup your PouchDB instance in the adapter with an extra parameter: |
@jlami I am trying to work around this problem too (using // app/adapters/application.ts
import PouchDB from 'pouchdb'; // Note: this is actually provided by ember-pouch
import pouchInMemoryPlugin from 'pouchdb-adapter-memory';
// ...
if (config.emberPouch.options && config.emberPouch.options.adapter === "memory") {
PouchDB.plugin(pouchInMemoryPlugin);
}
const db = new PouchDB(localDb, config.emberPouch.options);
// ... Although switching to the in-memory DB seems to have made the first error disappear
it has created a new one that is popping up all over the place now:
How do I "make sure that each test will create a separate app"? (Perhaps that is why this is happening?) I am using ember-cli 3.5.0 and the qunit testing convention that it ships with by default. |
How can i empty the stores after performing a test, I'm getting some async errors like this
I'm deleting the models like this
The text was updated successfully, but these errors were encountered: