-
Notifications
You must be signed in to change notification settings - Fork 614
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
Qn: In memory database for react-native #83
Comments
You'd probably need to mock But you could also tweak the SQLite adapter to allow in-memory databases. That would be easier. Both already work, but only in test environment. It wouldn't be difficult to change. I can give you pointers if you can send a pull request adding this capability. |
sure. may be sqlite inMemory mode is better as we don't need other drivers and dependencies. I think it will be useful for testing in isolation. thanks |
Well, I assume you're already using the React native native module for SQLite, so there's no extra dependencies. Loki should work too in-memory. We use that in common tests (but that runs in Node) |
so is there an easy way to configure the adapter to pass through :memory config |
I already said:
|
:-) I was asking about the pointers you said. quickly searched through the codebase and didn't find the driver setting. Sorry, didn't look through all the code yet. |
@bsr203 You'll have to start from this branch, not master, as there were changes in this area: https://github.com/Nozbe/WatermelonDB/pull/70/files#diff-010253597e9bd62ff04e3105667f6b66R45 right now, the database name is passed directly to sqlite only in test mode, otherwise documents filesystem path is prepended. This can be changed so that if dbName is I think this should work on Android without any changes. But if no, this is the line: https://github.com/Nozbe/WatermelonDB/pull/70/files#diff-2050916f6706022d034a09ab20dd9ed4R14 You'll find instructions for Xcode / Android setup and running native tests in CONTRIBUTING.md file |
@radex thanks for the details. I probably can't get to it right away, and let you know. thanks. |
Closing this. @bsr203 feel free to ask Qs if you want to get to implementing this in the future |
Hi,
I tried to use
lokijs
to run my test / storybook with sample data. Do you see issues using this adapter on react-native env. I currently getThe text was updated successfully, but these errors were encountered: