import 'package:apidash/dashbot/core/model/chat_attachment.dart'; import 'package:apidash/dashbot/core/providers/dashbot_window_notifier.dart'; import 'package:apidash/dashbot/features/chat/models/chat_action.dart'; import 'package:apidash/dashbot/features/chat/viewmodel/chat_viewmodel.dart'; import 'package:apidash/dashbot/core/constants/constants.dart'; class TestChatViewmodel extends ChatViewmodel { TestChatViewmodel(super.ref); final List applyAutoFixCalls = []; final List<({String text, ChatMessageType type, bool countAsUser})> sendMessageCalls = []; final List openApiAttachmentCalls = []; bool throwOnApplyAutoFix = false; @override Future applyAutoFix(ChatAction action) async { applyAutoFixCalls.add(action); if (throwOnApplyAutoFix) { throw Exception('applyAutoFix error'); } } @override Future sendMessage({ required String text, ChatMessageType type = ChatMessageType.general, bool countAsUser = true, }) async { sendMessageCalls.add((text: text, type: type, countAsUser: countAsUser)); } @override Future handleOpenApiAttachment(ChatAttachment att) async { openApiAttachmentCalls.add(att); } } class RecordingDashbotWindowNotifier extends DashbotWindowNotifier { int hideCalls = 0; int showCalls = 0; @override void hide() { hideCalls += 1; super.hide(); } @override void show() { showCalls += 1; super.show(); } }