forked from eatvio/eatvio_app
39 lines
1004 B
Dart
39 lines
1004 B
Dart
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);
|
||
});
|
||
});
|
||
}
|
||
|