28 lines
1023 B
Dart
28 lines
1023 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/chat/conversation/chat_thread_controller.dart';
|
|
|
|
import 'chat_thread_fixtures.dart';
|
|
|
|
void main() {
|
|
test('readable history never hides a refused live subscription', () async {
|
|
final gateway = FakeChatGateway();
|
|
gateway.subscribe = () async {
|
|
throw StateError('live watch denied');
|
|
};
|
|
gateway.history = (_) async =>
|
|
chatPage([chatMessage('stored', 'assistant')]);
|
|
addTearDown(gateway.close);
|
|
final controller = ChatThreadController(gateway, 's');
|
|
addTearDown(controller.dispose);
|
|
await controller.load();
|
|
expect(controller.messages.single['id'], 'stored');
|
|
expect(controller.error, isNull);
|
|
expect(controller.subscribed, isFalse);
|
|
expect(controller.subscriptionError, contains('live watch denied'));
|
|
gateway.subscribe = () async => {};
|
|
await controller.resync();
|
|
expect(controller.subscribed, isTrue);
|
|
expect(controller.subscriptionError, isNull);
|
|
});
|
|
}
|