react-native-onyx icon indicating copy to clipboard operation
react-native-onyx copied to clipboard

Create mock implementations for `react-native-quick-sqlite` and `idb-keyval`

Open chrispader opened this issue 1 year ago • 1 comments

As described in this P/S proposal i want to create mock implementations directly in react-native-quick-sqlite and idb-keyval, which we can then use to improve and add new (unit) tests in Onyx.

Proposal

Create a mock for react-native-quick-sqlite (and idb-keyval) to allow for testing the actual storage providers on different platforms :test_tube:

Problem

From time to time we experience (sometimes critical) bugs and problems with edge-cases in Onyx and therefore also in E/App. These are often caused by the underlying storage library on (only) one platform, native or web. In Onyx we are only testing the actual library logic, but storage implementation of the underlying storage providers - like SQLite and IndexedDB - remains untested.

Solution

Implement a mock for react-native-quick-sqlite (and idb-keyval) and use it within Onyx for unit and E2E tests. The storage providers we use in Onyx are working very differently but we're trying to use the same similarly for the most part. In order for the library to work the same on all platform, we should test the actual storage provider implementations on all platforms. We can then potentially also improve more exhaustive tests for flows and use-cases in E/App

@tgolen @roryabraham just checking if i can already start working on this, since the proposal got 4 upvotes (2 from Expensify employees) and no downvotes or negative comments.

chrispader avatar Apr 16 '24 08:04 chrispader

I think it's fine to start working on this, yeah.

tgolen avatar Apr 16 '24 14:04 tgolen