Files
eatvio_app/test/features/chat/models/websocket_info_model_test.dart

39 lines
1004 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:eatvio_app/features/chat/models/websocket_info_model.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('WebsocketInfoModel', () {
test('создает WebsocketInfoModel с правильными значениями', () {
const model = WebsocketInfoModel(
key: 'test-key',
host: 'localhost',
port: '6001',
cluster: 'mt1',
userId: 123,
);
expect(model.key, 'test-key');
expect(model.host, 'localhost');
expect(model.port, '6001');
expect(model.cluster, 'mt1');
expect(model.userId, 123);
});
test('fromJson создает WebsocketInfoModel из JSON', () {
final json = {
'key': 'test-key',
'host': 'localhost',
'port': '6001',
'cluster': 'mt1',
'user_id': 123,
};
final model = WebsocketInfoModel.fromJson(json);
expect(model.key, 'test-key');
expect(model.userId, 123);
});
});
}