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

Local persistence #4

Open
samselikoff opened this issue Jan 30, 2020 · 3 comments
Open

Local persistence #4

samselikoff opened this issue Jan 30, 2020 · 3 comments

Comments

@samselikoff
Copy link
Contributor

There was some previous design work done on this feature idea: miragejs/ember-cli-mirage#1028

@boshmaf
Copy link

boshmaf commented Apr 5, 2020

This will be useful if the app checks for a valid auth token in local storage and makes subsequent API calls using the token. Currently, there is no easy way to test this flow, especially if the token encodes some information that needs to be verified against (previously available) records (e.g., check a userId), which I assume is common in many apps today.

I can give this a try, if you think it's worth it. I noticed that there were a lot of code changes in the referenced PR that made it harder for you to move it forward. Any suggestions to avoid this scenario are much appreciated.

@samselikoff
Copy link
Contributor Author

Ya - thanks for offering to help 👍

The only thing about adding a feature like this to core is it further ties us to the browser and we have some plans to make Mirage work in node + further decouple portions of it from browser APIs. (That being said, today it is coupled to the browser so maybe that's not an issue.)

I would love to understand your use case today. I think with db.loadData() and db.dump() you should be able to test your flow in userland, without any new Mirage APIs. Then we can look at it and see if anything makes sense to extract back into Mirage.

Have you tried writing these tests yet? If not I'd be happy to offer some help!

@boshmaf
Copy link

boshmaf commented Apr 9, 2020

Yeah, db.loadData() and db.dump() should do it. Thanks for the pointer 👍

I don't have the tests yet, but I'll work on them now. Given the direction of the project, I think it's better to avoid introducing more browser APIs, as you mentioned.

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

2 participants