import 'package:flutter_test/flutter_test.dart'; import 'package:yumi/shared/business_logic/models/res/sc_room_emoji_res.dart'; void main() { group('SCRoomEmojiRes', () { test('parses backend emoji group fields defensively', () { final group = SCRoomEmojiRes.fromJson({ 'id': 1001, 'sysOrigin': 'LIKEI', 'groupCode': 'DEFAULT', 'groupName': 'Default', 'cover': 'https://cdn.example.com/emoji/default-cover.png', 'have': 'true', 'amount': '9.9', 'emojis': [ { 'sourceUrl': 'https://cdn.example.com/emoji/hello.svga', 'sourceType': '1', 'coverUrl': 'https://cdn.example.com/emoji/hello.png', 'type': 'NORMAL', }, ], }); expect(group.id, '1001'); expect(group.have, isTrue); expect(group.amount, 9.9); expect(group.emojis, hasLength(1)); expect(group.emojis!.first.sourceType, 1); expect(group.emojis!.first.previewUrl, contains('hello.png')); expect(group.emojis!.first.sendUrl, contains('hello.svga')); }); }); }