Closed popo63301 closed 6 years ago
@popo63301 Testing with Jest works :)
closing this; let me know if you're having troubles running Watermelon in Jest env
@radex Thank you ! I'll try to experiment it when I have time. 😄
Not working for me :/
@radex can give an example? How to mock?
.
Any news on that ?
Will share a workaround later
hi guys, can someone give a mock example please?
hi guys, can someone give a mock example please?
I've been using the node.js adapter mocking it via jest.
jest.mock(
'@nozbe/watermelondb/adapters/sqlite/makeDispatcher/index.native.js',
() => {
return jest.requireActual(
'@nozbe/watermelondb/adapters/sqlite/makeDispatcher/index.js',
);
},
);
It's been working great! You can see some notes on my full setup here: https://craigmulligan.com/posts/testing-with-watermelon/
Happy to submit a PR for docs or a jest module folks can include to automatically do the mocking if the maintainers are interested?
I am getting Error when I using
const syncStoreMaster = database.get
@shahulul1, have you tried mocking it with sqlite3? see my comment above
Hi guys !
This project looks amazing. I would like to know if you have planned to help people test a watermelonDB? As it requires an interaction with a local SQLite DB or Indexeddb, how about creating an official mock for watermelonDB so that people can test their app using Jest?