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

Serializing (and restoring) the state of Fake IDB #91

Open
joshdifabio opened this issue Oct 30, 2023 · 2 comments
Open

Serializing (and restoring) the state of Fake IDB #91

joshdifabio opened this issue Oct 30, 2023 · 2 comments

Comments

@joshdifabio
Copy link

joshdifabio commented Oct 30, 2023

I have the following use case for some automated tests:

  1. Run a JS application which reads/writes various data from/to Fake IDB
  2. Serialize the complete state of Fake IDB (e.g. to JSON)
  3. In a new context, rehydrate Fake IDB using the previous serialized state
  4. Run a JS application which reads/writes various data from/to Fake IDB, leveraging the state captured in step 2

Is there an easy way to achieve this with Fake IDB, or do I need to manually read/write all of the databases and objects using the regular IDB APIs?

@dumbmatter
Copy link
Owner

Right now there is no easy way to do this, you'd have to use the IndexedDB APIs. This would be a good feature to add in the future though.

@tylerweitzman
Copy link

I needed this use case too. I have created it in node-indexeddb

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

No branches or pull requests

3 participants