We would like to mock out the CBLite dependency in our swift iOS app.
Particularly CouchbaseLiteSwift.Database and CouchbaseLiteSwift.Collection classes.
Unfortunately, CouchbaseLiteSwift.Database is marked final and does not conform to a protocol. CouchbaseLiteSwift.Collection does conform to CouchbaseLiteSwift.CollectionChangeObservable, CouchbaseLiteSwift.Indexable, but not all the methods do.
We have our ideas on how to do this, which is to put it under a new protocol that we create and conform the Database and Collection classes to that.
protocol MyDatabase {
//existing CBlite methods
}
extension Database: MyDatabase {}
And then pass around the protocol type of MyDatabase
to call sites in the code.
We don’t want to spin up a full fledged Database instance for each unit test.
What is the official recommendation from the core CB swift team?