You can see a basic example in KaMPKit.
If you have sqldelight configured in your non-test code, you don't need the driver dependency on it's own in the commonTest
.
In our test code, we have an expect
that creates the db connection for test.
internal expect fun testDbConnection(): SqlDriver
Then in iOS and Android code, the actual
definitions.
The dependency config looks (roughly) like this:
commonMain {
implementation("com.squareup.sqldelight:runtime:1.4.4")
}
androidMain {
implementation("com.squareup.sqldelight:android-driver:1.4.4")
}
iosMain {
implementation("com.squareup.sqldelight:native-driver:1.4.4")
}
With that, you should be able to write sqldelight tests.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…