Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Implement and Test StepRequestBody Model

hunteraraujoc4d08aefb9d9
diff --git a/lib/models/step_request_body.dart b/lib/models/step_request_body.dart
new file mode 100644
index 0000000000..6f8fb7cb16
--- /dev/null
+++ b/lib/models/step_request_body.dart
@@ -0,0 +1,10 @@
+class StepRequestBody {
+ final String input;
+ final Map<String, dynamic>? additionalInput;
+
+ StepRequestBody({required this.input, this.additionalInput});
+
+ Map<String, dynamic> toJson() {
+ return {'input': input, 'additional_input': additionalInput};
+ }
+}
diff --git a/test/step_request_body_test.dart b/test/step_request_body_test.dart
new file mode 100644
index 0000000000..d15a95f6d8
--- /dev/null
+++ b/test/step_request_body_test.dart
@@ -0,0 +1,26 @@
+import 'package:auto_gpt_flutter_client/models/step_request_body.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+void main() {
+ group('StepRequestBody', () {
+ test('should create StepRequestBody with correct values', () {
+ final stepRequestBody = StepRequestBody(
+ input: 'Execute something', additionalInput: {'key': 'value'});
+
+ expect(stepRequestBody.input, 'Execute something');
+ expect(stepRequestBody.additionalInput, {'key': 'value'});
+ });
+
+ test('should convert StepRequestBody to correct JSON', () {
+ final stepRequestBody = StepRequestBody(
+ input: 'Execute something', additionalInput: {'key': 'value'});
+
+ final json = stepRequestBody.toJson();
+
+ expect(json, {
+ 'input': 'Execute something',
+ 'additional_input': {'key': 'value'}
+ });
+ });
+ });
+}