Skip to content

Commit 31610b9

Browse files
committed
realtime subscription test
1 parent 28b725d commit 31610b9

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/SDK/Language/Flutter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ public function getFiles(): array
290290
'destination' => '/test/src/realtime_response_connected_test.dart',
291291
'template' => 'flutter/test/src/realtime_response_connected_test.dart.twig',
292292
],
293+
[
294+
'scope' => 'default',
295+
'destination' => '/test/src/realtime_subscription_test.dart',
296+
'template' => 'flutter/test/src/realtime_subscription_test.dart.twig',
297+
],
293298
[
294299
'scope' => 'default',
295300
'destination' => '/test/src/enums_test.dart',
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import 'package:mockito/mockito.dart';
2+
import 'package:{{lang.params.packageName}}/src/realtime_message.dart';
3+
import 'package:{{lang.params.packageName}}/src/realtime_subscription.dart';
4+
import 'package:flutter_test/flutter_test.dart';
5+
6+
class MockStream<T> extends Mock implements Stream<T> {}
7+
8+
9+
10+
void main() {
11+
group('RealtimeSubscription', () {
12+
final mockStream = MockStream<RealtimeMessage>();
13+
final mockCloseFunction = () async {};
14+
final subscription = RealtimeSubscription(stream: mockStream, close: mockCloseFunction);
15+
16+
test('should have the correct stream and close function', () {
17+
expect(subscription.stream, equals(mockStream));
18+
expect(subscription.close, equals(mockCloseFunction));
19+
});
20+
});
21+
}

0 commit comments

Comments
 (0)