mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
28 lines
988 B
Dart
28 lines
988 B
Dart
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');
|
|
});
|
|
});
|
|
}
|