import 'package:pipelines_app/core/api_gateway.dart'; import 'chat_thread_fixtures.dart'; class TasksGateway extends FakeChatGateway { TasksGateway() { history = (_) async => chatPage([]); } Future Function(JsonMap)? shells; Future Function(JsonMap)? output; @override Future call(String type, [JsonMap fields = const {}]) { if (type == 'chat_shells' || type == 'chat_shell_output') { calls.add((type: type, fields: fields)); if (type == 'chat_shells') { return shells?.call(fields) ?? Future.value({'chat_shells': []}); } return output?.call(fields) ?? Future.value({'chat_shell_output': {}}); } return super.call(type, fields); } void shell(String id, String status, {String session = 's'}) => emitEvent({ 'session_id': session, 'kind': 'shell', 'shell': {'id': id, 'status': status, 'command': 'command $id'}, }); } Map task(String id) => { 'id': id, 'status': 'running', 'command': 'command $id', };