Skip to content

Commit

Permalink
Add an individual test for request handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthiee committed May 5, 2024
1 parent 12c29d9 commit 9ba49b0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/unit/request/request_handler/request_handler_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'package:dart_mediator/src/request/handler/request_handler.dart';
import 'package:test/test.dart';

import '../../../mocks.dart';

void main() {
group('RequestHandler', () {
setUp(() {});

group('handle', () {
test('it handles the request', () {
var handled = false;
final mockRequest = MockRequest<int>();
final handler = RequestHandler<int, MockRequest<int>>.function((req) {
handled = true;
return 123;
});

expect(handler.handle(mockRequest), 123);
expect(handled, isTrue);
});
});
});
}

0 comments on commit 9ba49b0

Please sign in to comment.