https://kotlinlang.org logo
#kotest
Title
# kotest
s

Sergio Crespo Toubes

05/27/2022, 11:17 AM
Hello, how is the best way to do this with kotest?
Copy code
val item = turbineState.awaitItem()
item.showProgress.shouldBe(false)
item.selectedItem.shouldBe(-1)
item.filteredLocations.count().shouldBe(2)
I tried this code but is not working...
Copy code
turbineState.awaitItem().should {
   !it.showProgress &&
   it.selectedItem == -1 &&
   it.filteredLocations.count() == 2
}
e

Emil Kantis

05/27/2022, 11:32 AM
something like
Copy code
turbineState.awaitItem().should {
   it.showProgress shouldBe false
   it.selectedItem shouldBe -1 
   it.filteredLocations shouldHaveSize 2
}
?
d

Davio

05/27/2022, 11:49 AM
You can also use
assertSoftly(item) { showProgress shouldBe false..etc }
which changes the functionality a bit (does all the asserts and fails at the end, not just until one fails)
👍 2
s

Sergio Crespo Toubes

05/27/2022, 11:59 AM
Thank you both. It works.
4 Views