Skip to content

Commit

Permalink
Add a test for FEitherSyntax.flatMapOrKeepIn
Browse files Browse the repository at this point in the history
  • Loading branch information
danicheg committed Jun 15, 2024
1 parent 3797bf1 commit 44806a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shared/src/test/scala/mouse/FEitherSyntaxTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ class FEitherSyntaxTest extends MouseSuite {
assertEquals(leftValue.flatMapIn(i => (i * 2).asRight[String]), leftValue)
}

test("FEitherSyntax.flatMapOrKeepIn") {
assertEquals(rightValue.flatMapOrKeepIn { case 42 => 84.asRight[String] }, List(84.asRight[String]))
assertEquals(rightValue.flatMapOrKeepIn { case 84 => 42.asRight[String] }, rightValue)
assertEquals(leftValue.flatMapOrKeepIn { case 42 => 84.asRight[String] }, leftValue)
}

test("FEitherSyntax.leftWidenIn") {
val initial: Option[Either[List[Int], String]] = Option(List(1).asLeft[String])
val expected: Option[Either[Seq[Int], String]] = Option(Seq(1).asLeft[String])
Expand Down

0 comments on commit 44806a0

Please sign in to comment.