refactor: migrate models to freezed + json_serializable
This commit is contained in:
@@ -59,13 +59,19 @@ void main() {
|
||||
});
|
||||
|
||||
group('MediaSort equality & hashCode', () {
|
||||
test('equality is based on key only (matches current contract)', () {
|
||||
test('value equality across all fields', () {
|
||||
final a = MediaSort(key: 'k', descKey: 'k:desc', title: 'A', defaultDirection: 'asc');
|
||||
final b = MediaSort(key: 'k', descKey: 'other', title: 'B', defaultDirection: 'desc');
|
||||
final b = MediaSort(key: 'k', descKey: 'k:desc', title: 'A', defaultDirection: 'asc');
|
||||
expect(a, equals(b));
|
||||
expect(a.hashCode, b.hashCode);
|
||||
});
|
||||
|
||||
test('differing non-key fields make instances unequal', () {
|
||||
final a = MediaSort(key: 'k', descKey: 'k:desc', title: 'A', defaultDirection: 'asc');
|
||||
final b = MediaSort(key: 'k', descKey: 'other', title: 'B', defaultDirection: 'desc');
|
||||
expect(a, isNot(equals(b)));
|
||||
});
|
||||
|
||||
test('different keys are not equal', () {
|
||||
final a = MediaSort(key: 'k1', title: 'A');
|
||||
final b = MediaSort(key: 'k2', title: 'A');
|
||||
|
||||
Reference in New Issue
Block a user