Pagination
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
import 'package:tasq/providers/typing_provider.dart';
|
||||
|
||||
void main() {
|
||||
test(
|
||||
'TypingIndicatorController ignores late remote events after dispose',
|
||||
() async {
|
||||
final client = SupabaseClient('http://localhost', 'test-key');
|
||||
final controller = TypingIndicatorController(client, 'ticket-1');
|
||||
|
||||
// initial state should be empty
|
||||
expect(controller.state.userIds, isEmpty);
|
||||
|
||||
// Simulate a remote "start typing" arriving while alive
|
||||
controller.debugSimulateRemoteTyping('user-2');
|
||||
expect(controller.state.userIds, contains('user-2'));
|
||||
|
||||
// Dispose the controller
|
||||
controller.dispose();
|
||||
|
||||
// Calling the remote handlers after dispose must NOT throw and must be no-ops
|
||||
expect(
|
||||
() => controller.debugSimulateRemoteTyping('user-3'),
|
||||
returnsNormally,
|
||||
);
|
||||
expect(
|
||||
() => controller.debugSimulateRemoteTyping('user-2', stop: true),
|
||||
returnsNormally,
|
||||
);
|
||||
|
||||
// Ensure state was not modified after dispose
|
||||
expect(controller.mounted, isFalse);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user