You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe 🙏
Since Algolia provides nothing like LocalStack for testing, I must write poor tests that mock the Algolia client object. The test must mock partialUpdateObjects. Unfortunately, Kotlin client library uses an extension function which makes mocking very hard. I haven't figured it out yet.
val responseBatch = mockk<ResponseBatch>() {
every {
// Unresolved reference: wait
wait()
}
}
val updates = slot<List<Pair<ObjectID, Partial>>>()
val index = mockk<Index>() {
coEvery {
partialUpdateObjects(
createIfNotExists =true,
partials = capture(updates)
)
}
}
Describe the solution you'd like 🤔
Remove the need to call wait() and instead make partialUpdateObjects a suspend function.
Describe alternatives you've considered ✨
Writing a test harness to create an index per test run and delete it afterward. This would be a real integration test.
Wrapping the Algolia client in a class that can be mocked, with suspend functions.
Additional context implementation("com.algolia:algoliasearch-client-kotlin:2.1.5")
Kotlin version 1.9.0-release-358 (JRE 20.0.1)
IntelliJ IDEA 2023.2 (Community Edition)
Build #IC-232.8660.185, built on July 25, 2023
Runtime version: 17.0.7+7-b1000.6 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.5
Non-Bundled Plugins:
Kotlin: 232-1.9.0-IJ8660.185
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe 🙏
Since Algolia provides nothing like LocalStack for testing, I must write poor tests that mock the Algolia client object. The test must mock
partialUpdateObjects
. Unfortunately, Kotlin client library uses an extension function which makes mocking very hard. I haven't figured it out yet.Describe the solution you'd like 🤔
Remove the need to call
wait()
and instead makepartialUpdateObjects
a suspend function.Describe alternatives you've considered ✨
Additional context
implementation("com.algolia:algoliasearch-client-kotlin:2.1.5")
Kotlin version 1.9.0-release-358 (JRE 20.0.1)
IntelliJ IDEA 2023.2 (Community Edition)
Build #IC-232.8660.185, built on July 25, 2023
Runtime version: 17.0.7+7-b1000.6 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.5
Non-Bundled Plugins:
Kotlin: 232-1.9.0-IJ8660.185
The text was updated successfully, but these errors were encountered: