import 'package:test/test.dart'; import '../../../../bin/domain/entities/album.dart'; void main() { group('Album', () { test('should create an Album with required fields', () { final now = DateTime.now(); final album = Album( id: 1, name: 'Vacation', createdAt: now, updatedAt: now, ); expect(album.id, 1); expect(album.name, 'Vacation'); expect(album.createdAt, now); expect(album.updatedAt, now); }); test('toJson should return correct map', () { final now = DateTime(2024, 1, 1, 12, 0, 0); final album = Album( id: 42, name: 'Birthday', createdAt: now, updatedAt: now, ); final json = album.toJson(); expect(json, isA>()); expect(json['id'], 42); expect(json['name'], 'Birthday'); expect(json['createdAt'], now.toIso8601String()); expect(json['updatedAt'], now.toIso8601String()); }); test('toJson should serialize dates in ISO8601 format', () { final createdAt = DateTime(2023, 6, 15); final updatedAt = DateTime(2023, 12, 25); final album = Album( id: 1, name: 'Test', createdAt: createdAt, updatedAt: updatedAt, ); final json = album.toJson(); expect(json['createdAt'], '2023-06-15T00:00:00.000'); expect(json['updatedAt'], '2023-12-25T00:00:00.000'); }); test('should handle empty name', () { final now = DateTime.now(); final album = Album(id: 0, name: '', createdAt: now, updatedAt: now); expect(album.name, ''); expect(album.toJson()['name'], ''); }); }); }