cofounderella/test/list_utils_test.dart

50 lines
1.5 KiB
Dart
Raw Normal View History

2024-06-14 14:28:59 +02:00
import 'package:cofounderella/utils/list_utils.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('equalContent', () {
test('returns true for lists with the same content in the same order', () {
List<dynamic> list1 = [1, 2, 3];
List<dynamic> list2 = [1, 2, 3];
bool result = equalContent(list1, list2);
expect(result, true);
});
test('returns true for lists with the same content in different orders',
() {
List<dynamic> list1 = [1, 2, 3];
List<dynamic> list2 = [3, 1, 2];
bool result = equalContent(list1, list2);
expect(result, true);
});
test('returns false for lists with different content', () {
List<dynamic> list1 = [1, 2, 3];
List<dynamic> list2 = [1, 2, 4];
bool result = equalContent(list1, list2);
expect(result, false);
});
test('returns false for lists with different lengths', () {
List<dynamic> list1 = [1, 2, 3];
List<dynamic> list2 = [1, 2];
bool result = equalContent(list1, list2);
expect(result, false);
});
test('returns true for empty lists', () {
List<dynamic> list1 = [];
List<dynamic> list2 = [];
bool result = equalContent(list1, list2);
expect(result, true);
});
test('returns false for one empty and one non-empty list', () {
List<dynamic> list1 = [];
List<dynamic> list2 = [1];
bool result = equalContent(list1, list2);
expect(result, false);
});
});
}