Skip to content

Commit c0ffc06

Browse files
committed
update tests
1 parent ef0e390 commit c0ffc06

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

lib/dashbot/providers/chat_viewmodel.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,12 @@ class ChatViewmodel extends StateNotifier<ChatState> {
501501
diff: diff,
502502
newReq: payload,
503503
);
504-
debugPrint("Prompt $sys");
505504
final res = await _repo.sendChat(
506505
request: ai.copyWith(
507506
systemPrompt: sys,
508507
stream: false,
509508
),
510509
);
511-
debugPrint("Response $res");
512510
String? insights;
513511
if (res != null && res.isNotEmpty) {
514512
try {
@@ -833,8 +831,8 @@ class ChatViewmodel extends StateNotifier<ChatState> {
833831
_appendSystem(
834832
'Created a new request from the cURL.', ChatMessageType.importCurl);
835833
}
836-
} catch (_) {
837-
_appendSystem('Error encountered while importing cURL.',
834+
} catch (e) {
835+
_appendSystem('Error encountered while importing cURL - $e',
838836
ChatMessageType.importCurl);
839837
}
840838
}

pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ packages:
388388
path: "packages/curl_parser"
389389
relative: true
390390
source: path
391-
version: "0.1.4-dev"
391+
version: "0.1.5-dev"
392392
dart_jsonwebtoken:
393393
dependency: transitive
394394
description:

test/dashbot/features/chat/viewmodel/chat_viewmodel_test.dart

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,8 @@ paths:
10761076
expect(viewmodel.currentMessages, hasLength(1));
10771077
expect(viewmodel.currentMessages.first.messageType,
10781078
equals(ChatMessageType.importCurl));
1079-
expect(viewmodel.currentMessages.first.content, contains('cURL parsed'));
1079+
expect(viewmodel.currentMessages.first.content,
1080+
contains('"action":"apply_curl","target":"httpRequestModel"'));
10801081
});
10811082

10821083
test('handlePotentialCurlPaste should handle invalid cURL command',
@@ -1299,10 +1300,12 @@ paths:
12991300
actionType: ChatActionType.applyCurl,
13001301
targetType: ChatActionTarget.httpRequestModel,
13011302
value: {
1302-
'method': 'POST',
1303-
'uri': 'https://api.apidash.dev/users',
1304-
'headers': {'Content-Type': 'application/json'},
1305-
'data': '{"name": "John"}',
1303+
'method': 'post',
1304+
'url': 'https://api.apidash.dev/users',
1305+
'headers': [
1306+
{'name': 'Content-Type', 'value': 'application/json; charset=utf-8'}
1307+
],
1308+
'body': '{"name": "John"}',
13061309
},
13071310
);
13081311

@@ -1324,7 +1327,7 @@ paths:
13241327
actionType: ChatActionType.applyCurl,
13251328
targetType: ChatActionTarget.httpRequestModel,
13261329
value: {
1327-
'method': 'POST',
1330+
'method': 'post',
13281331
'uri': 'https://api.apidash.dev/upload',
13291332
'formData': [
13301333
{'name': 'file', 'value': 'test.txt', 'type': 'text'},
@@ -1444,7 +1447,7 @@ paths:
14441447
actionType: ChatActionType.applyCurl,
14451448
targetType: ChatActionTarget.httpRequestModel,
14461449
value: {
1447-
'method': 'GET',
1450+
'method': 'get',
14481451
'uri': 'https://api.apidash.dev/test',
14491452
},
14501453
);

0 commit comments

Comments
 (0)