Correct return types of mapBoth calls
This commit is contained in:
parent
faf315d395
commit
8dc7015910
@ -59,8 +59,8 @@ internal class MapTest {
|
|||||||
internal fun `mapBoth should return the transformed result value if ok`() {
|
internal fun `mapBoth should return the transformed result value if ok`() {
|
||||||
val value = ok("there is").mapBoth(
|
val value = ok("there is").mapBoth(
|
||||||
success = { "$it a light" },
|
success = { "$it a light" },
|
||||||
failure = { MapError.CustomError("$it that never") }
|
failure = { "$it that never" }
|
||||||
) as String
|
)
|
||||||
|
|
||||||
assertThat(value, equalTo("there is a light"))
|
assertThat(value, equalTo("there is a light"))
|
||||||
}
|
}
|
||||||
@ -69,17 +69,17 @@ internal class MapTest {
|
|||||||
internal fun `mapBoth should return the transformed result error if not ok`() {
|
internal fun `mapBoth should return the transformed result error if not ok`() {
|
||||||
val error = error(MapError.CustomError("this")).mapBoth(
|
val error = error(MapError.CustomError("this")).mapBoth(
|
||||||
success = { "$it charming" },
|
success = { "$it charming" },
|
||||||
failure = { MapError.CustomError("${it.reason} man") }
|
failure = { "${it.reason} man" }
|
||||||
) as MapError.CustomError
|
)
|
||||||
|
|
||||||
assertThat(error.reason, equalTo("this man"))
|
assertThat(error, equalTo("this man"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
internal fun `mapEither should return the transformed result value if ok`() {
|
internal fun `mapEither should return the transformed result value if ok`() {
|
||||||
val result = ok(500).mapEither(
|
val result = ok(500).mapEither(
|
||||||
success = { it + 500 },
|
success = { it + 500 },
|
||||||
failure = { MapError.CustomError(it) }
|
failure = { MapError.CustomError("$it") }
|
||||||
)
|
)
|
||||||
|
|
||||||
result as Ok
|
result as Ok
|
||||||
|
Loading…
Reference in New Issue
Block a user