Unit Test
You can unit test your application directly against Replicache, without having to mock out Replicache's interface. To do so, there are a few considerations:
- You'll need to run your tests in a web environment like
web-test-runner
, because Replicache has DOM dependencies. - You should use
TEST_LICENSE_KEY
for your license during automated tests to prevent inflated usage. - You'll want to disable sync. You can do this with any of:
- Set
pullURL
andpushURL
toundefined
. These are read/write so clearing them prevents next push/pull. - Set a large delay: setting a large
pushDelay
will prevent automatically pushing after a mutation. SettingpullInterval
will increase the time to the next pull. - You could implement a custom
puller
/pusher
.
- Set
- You may want to run Replicache in-memory. This can be done by setting the kvStore parameter to
mem
.- Alternately, you can keep using the persistent storage and pick a randomly-generated
name
for your Replicache instance each time you create it.
- Alternately, you can keep using the persistent storage and pick a randomly-generated