tests: add chat model tests(cv: 100)

This commit is contained in:
Udhay-Adithya
2025-09-25 13:37:53 +05:30
parent f2ce403006
commit 066aa0fcf4
10 changed files with 504 additions and 14 deletions

View File

@@ -0,0 +1,27 @@
import 'package:apidash/dashbot/core/constants/constants.dart';
import 'package:apidash/dashbot/features/chat/models/chat_response.dart';
import 'package:test/test.dart';
void main() {
group('ChatResponse equality & copyWith', () {
test('equality & hashCode', () {
const r1 =
ChatResponse(content: 'Hi', messageType: ChatMessageType.general);
const r2 =
ChatResponse(content: 'Hi', messageType: ChatMessageType.general);
expect(r1, r2);
expect(r1.hashCode, r2.hashCode);
expect(r1.toString(), contains('ChatResponse'));
});
test('copyWith modifies only provided fields', () {
const r1 = ChatResponse(content: 'One');
final r2 = r1.copyWith(content: 'Two');
expect(r2.content, 'Two');
expect(r2.messageType, isNull);
final r3 = r2.copyWith(messageType: ChatMessageType.generateCode);
expect(r3.messageType, ChatMessageType.generateCode);
expect(r3.content, 'Two');
});
});
}