Package-level declarations
Helpers to use Arrow's Resource DSL in tests.
Let's assume that we want to test a service we own that is already encapsulated in a resource within your production code:
val userProcessor: Resource<UserProcessor> = resource({
UserProcessor().also { it.start() }
}) { p, _ -> p.shutdown() }
val dataSource: Resource<DataSource> = resource({
DataSource().also { it.connect() }
}) { ds, exitCase ->
println("Releasing $ds with exit: $exitCase")
withContext(Dispatchers.IO) { ds.close() }
}
val service: Resource<Service> = resource {
Service(dataSource.bind(), userProcessor.bind())
}Content copied to clipboard
We can use asPrepared to convert that resource into Prepared's native prepared values:
val preparedService by service.asPrepared()
test("create() should not return null") {
check(preparedService().create() != null)
}Content copied to clipboard
Types
Link copied to clipboard
A scope to combine Arrow's ResourceScope with Prepared's TestDsl.
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Declares a prepared value that contains Arrow Resources.
Link copied to clipboard
Allows accessing the test lifecycle as an Arrow's ResourceScope.