Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also follow the same ScalaMocks pattern as the core library
- Loading branch information
Showing
3 changed files
with
63 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
cats/src/test/scala/eu/monniot/scala3mock/cats/CatsSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package eu.monniot.scala3mock.cats | ||
|
||
import cats.effect.SyncIO | ||
|
||
class CatsSuite extends munit.FunSuite with ScalaMocks { | ||
|
||
test("it should validate expectations after a lazy data type evaluated") { | ||
// An implicit assumption of this code block is that the expectations | ||
// are not validated on exit of the `withExpectations` function but when | ||
// the returned Monad is being evaluated. | ||
val fa = withExpectations() { | ||
val intToStringMock = mockFunction[Int, String] | ||
intToStringMock.expects(*) | ||
|
||
SyncIO(intToStringMock(2)) | ||
} | ||
|
||
assertEquals(fa.unsafeRunSync(), null) | ||
} | ||
|
||
} |