import 'package:eatvio_app/core/enums/complained_content.dart'; import 'package:eatvio_app/features/complaining/models/complain_model.dart'; import 'package:eatvio_app/features/complaining/presentation/complaining_bottom_sheet.dart'; import 'package:eatvio_app/features/complaining/presentation/cubit/complaining_state.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('ComplainingState', () { test('creates ComplainingState with default values', () { final state = ComplainingState(); expect(state.isLoading, false); expect(state.wasSentSuccessfully, null); expect(state.category, null); expect(state.contentType, null); expect(state.contentId, null); expect(state.contentSlug, null); expect(state.complainInfo, isA()); }); test('creates ComplainingState with custom values', () { final state = ComplainingState( isLoading: true, wasSentSuccessfully: true, category: ComplainType.spam, contentType: ComplainedContent.recipe, contentId: 1, contentSlug: 'test-slug', complainInfo: const ComplainModel( description: 'Test description', tags: ['tag1', 'tag2'], ), ); expect(state.isLoading, true); expect(state.wasSentSuccessfully, true); expect(state.category, ComplainType.spam); expect(state.contentType, ComplainedContent.recipe); expect(state.contentId, 1); expect(state.contentSlug, 'test-slug'); expect(state.complainInfo.description, 'Test description'); expect(state.complainInfo.tags, ['tag1', 'tag2']); }); test('copyWith creates new instance with updated values', () { final original = ComplainingState(); final updated = original.copyWith( isLoading: true, category: ComplainType.spam, contentType: ComplainedContent.plan, ); expect(updated.isLoading, true); expect(updated.category, ComplainType.spam); expect(updated.contentType, ComplainedContent.plan); expect(original.isLoading, false); }); test('copyWith keeps original values when not updated', () { final original = ComplainingState( isLoading: true, category: ComplainType.spam, ); final updated = original.copyWith(); expect(updated.isLoading, original.isLoading); expect(updated.category, original.category); }); test('copyWith.complainInfo updates complainInfo', () { final original = ComplainingState(); final updated = original.copyWith.complainInfo( description: 'New description', tags: ['new_tag'], ); expect(updated.complainInfo.description, 'New description'); expect(updated.complainInfo.tags, ['new_tag']); expect(original.complainInfo.description, isNull); }); test('handles different ComplainType values', () { final state1 = ComplainingState(category: ComplainType.spam); final state2 = ComplainingState(category: ComplainType.lawViolation); final state3 = ComplainingState(category: ComplainType.deception); final state4 = ComplainingState(category: ComplainType.violenceDndHostility); final state5 = ComplainingState(category: ComplainType.explicitImage); expect(state1.category, ComplainType.spam); expect(state2.category, ComplainType.lawViolation); expect(state3.category, ComplainType.deception); expect(state4.category, ComplainType.violenceDndHostility); expect(state5.category, ComplainType.explicitImage); }); test('handles different ComplainedContent values', () { final state1 = ComplainingState(contentType: ComplainedContent.diet); final state2 = ComplainingState(contentType: ComplainedContent.plan); final state3 = ComplainingState(contentType: ComplainedContent.recipe); expect(state1.contentType, ComplainedContent.diet); expect(state2.contentType, ComplainedContent.plan); expect(state3.contentType, ComplainedContent.recipe); }); test('equality works correctly', () { final state1 = ComplainingState( isLoading: true, category: ComplainType.spam, contentType: ComplainedContent.recipe, contentId: 1, ); final state2 = ComplainingState( isLoading: true, category: ComplainType.spam, contentType: ComplainedContent.recipe, contentId: 1, ); final state3 = ComplainingState( isLoading: false, category: ComplainType.spam, contentType: ComplainedContent.recipe, contentId: 1, ); expect(state1 == state2, isTrue); expect(state1 == state3, isFalse); }); }); }