이벤트 가져오기 위젯 테스트 추가 및 테스트 훅 도입

This commit is contained in:
2025-09-12 06:33:44 +09:00
parent 107abc963f
commit a5f2544d11
121 changed files with 39277 additions and 3911 deletions
@@ -0,0 +1,72 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:lanebow/models/participant_model.dart';
void main() {
group('Participant.fromJson', () {
test('maps flat fields including isPaid true via paymentStatus', () {
final json = {
'id': 1,
'eventId': 10,
'memberId': 55,
'name': '홍길동',
'email': 'hong@example.com',
'phoneNumber': '010-1234-5678',
'status': 'confirmed',
'paymentStatus': 'paid',
'paidAmount': '15000',
'notes': '',
};
final p = Participant.fromJson(json);
expect(p.id, '1');
expect(p.eventId, '10');
expect(p.memberId, '55');
expect(p.name, '홍길동');
expect(p.email, 'hong@example.com');
expect(p.phoneNumber, '010-1234-5678');
expect(p.status, 'confirmed');
expect(p.isPaid, isTrue);
expect(p.paidAmount, 15000);
expect(p.notes, '');
});
test('maps nested Member fields and unpaid status', () {
final json = {
'id': '2',
'eventId': '11',
'memberId': '99',
'status': 'registered',
'paymentStatus': 'unpaid',
'Member': {
'name': '이순신',
'email': 'lee@example.com',
'phone': '010-0000-0000',
},
};
final p = Participant.fromJson(json);
expect(p.name, '이순신');
expect(p.email, 'lee@example.com');
expect(p.phoneNumber, '010-0000-0000');
expect(p.isPaid, isFalse);
});
test('keeps nulls when empty strings provided for optional fields', () {
final json = {
'id': '3',
'eventId': '12',
'memberId': '100',
'name': null,
'email': null,
'phone': null,
'status': null,
};
final p = Participant.fromJson(json);
expect(p.name, isNull);
expect(p.email, isNull);
expect(p.phoneNumber, isNull);
expect(p.status, isNull);
});
});
}