Skip to content

Commit

Permalink
Add tests for FEitherOps#leftFlatMapOrKeepIn
Browse files Browse the repository at this point in the history
  • Loading branch information
danicheg committed Jul 27, 2024
1 parent a7240cf commit 9d7b41a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions shared/src/test/scala/mouse/FEitherSyntaxTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ class FEitherSyntaxTest extends MouseSuite {
assertEquals(leftValue.leftFlatMapIn(_ => "".asLeft[Int]), List("".asLeft[Int]))
}

test("FEitherSyntax.leftFlatMapOrKeepIn") {
assertEquals(rightValue.leftFlatMapOrKeepIn { case "42" => Left("") }, rightValue)
assertEquals(leftValue.leftFlatMapOrKeepIn { case "4242" => Right(42) }, leftValue)
assertEquals(leftValue.leftFlatMapOrKeepIn { case "42" => Left("") }, List(Left("")))
assertEquals(leftValue.leftFlatMapOrKeepIn { case "42" => Right(42) }, rightValue)
}

test("FEitherSyntax.leftFlatMapF") {
assertEquals(rightValue.leftFlatMapF(_ => List("".asLeft[Int])), rightValue)
assertEquals(leftValue.leftFlatMapF(_ => List("".asLeft[Int])), List("".asLeft[Int]))
Expand Down

0 comments on commit 9d7b41a

Please sign in to comment.