-
Notifications
You must be signed in to change notification settings - Fork 144
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
Testing with Jest and Fake Indexed DB #105
Comments
Not sure what you mean? It doesn't add anything IDB would consider an index.
Why does it need an index? (closing, but I'll continue replying) |
Thanks for the quick response. Yes, I meant, that we don't have to set up an index explicitly when working with idb-keyval.
Yes, you are right, index is not mandatory, but when I remove index and add keypath for Fake Indexed DB as follow, something seems wrong in setting up the DB as compared to DB set by idb-keyval, and as a result, my unit test is failing.
The DB setup in the browser is as below. Does anything seem wrong with my approach? |
The stuff in https://github.com/jakearchibald/idb-keyval/blob/main/custom-stores.md might help, but once you need to do more complex stuff with the database, you might be better off with idb-keyval's sister library: https://www.npmjs.com/package/idb |
This is not an issue but a query.
I need to write unit tests for some functionalities with regards to idb-keyval library that I have integrated.
I am using jest and fake-indexeddb packages for testing.
As per my knowledge, idb-keyval doesn't use concept of indexes. Correct me if wrong.
But for unit testing, I need to setup indexed DB with Fake Indexed DB library, which requires setting up an index with the createIndex method.
How do I simulate same data format stored by idb-keyval with the Fake Indexed DB library, any idea?
The text was updated successfully, but these errors were encountered: