Correct return types of mapBoth calls

This commit is contained in:
Michael Bull 2017-10-21 04:29:18 +01:00
parent faf315d395
commit 8dc7015910
1 changed files with 6 additions and 6 deletions

View File

@ -59,8 +59,8 @@ internal class MapTest {
internal fun `mapBoth should return the transformed result value if ok`() {
val value = ok("there is").mapBoth(
success = { "$it a light" },
failure = { MapError.CustomError("$it that never") }
) as String
failure = { "$it that never" }
)
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`() {
val error = error(MapError.CustomError("this")).mapBoth(
success = { "$it charming" },
failure = { MapError.CustomError("${it.reason} man") }
) as MapError.CustomError
failure = { "${it.reason} man" }
)
assertThat(error.reason, equalTo("this man"))
assertThat(error, equalTo("this man"))
}
@Test
internal fun `mapEither should return the transformed result value if ok`() {
val result = ok(500).mapEither(
success = { it + 500 },
failure = { MapError.CustomError(it) }
failure = { MapError.CustomError("$it") }
)
result as Ok