Skip to content

Commit

Permalink
interruption test
Browse files Browse the repository at this point in the history
  • Loading branch information
SandroMaglione committed Mar 28, 2024
1 parent da0b2ee commit 9c8610c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/fpdart/test/src/effect/effect_interruption_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import "package:fpdart/fpdart.dart";
import "package:test/test.dart";

void main() {
group(
"Effect interruption",
() {
group('interrupt', () {
test('fail with Cause.Interrupted', () {
final main = Effect<Null, String, int>.succeed(10).interrupt().map(
(r) => r + 10,
);

final result = main.runSyncExit();
switch (result) {
case Right():
fail("Either expected to be Left: $result");
case Left(value: final value):
expect(value, isA<Interrupted>());
}
});
});
},
);
}

0 comments on commit 9c8610c

Please sign in to comment.