mirror of
https://github.com/immich-app/immich.git
synced 2024-12-21 01:39:59 +02:00
af32183728
* refactor: autoroutex pushroute * refactor: autoroutex popRoute * refactor: autoroutex navigate and replace * chore: add doc comments for extension methods * refactor: Add LoggerMixin and refactor Album activities to use mixin * refactor: Activity page * chore: activity user from user constructor * fix: update current asset after build method * refactor: tests with similar structure as lib * chore: remove avoid-declaring-call-method rule from dcm analysis * test: fix proper expect order * test: activity_statistics_provider_test * test: activity_provider_test * test: use proper matchers * test: activity_text_field_test & dismissible_activity_test added * test: add http mock to return transparent image * test: download isar core libs during test * test: add widget tags to widget test cases * test: activity_tile_test * build: currentAlbumProvider to generator * movie add / remove like to activity input tile * test: activities_page_test.dart * chore: better error logs * chore: dismissibleactivity as statelesswidget --------- Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
56 lines
1.4 KiB
Dart
56 lines
1.4 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:immich_mobile/extensions/collection_extensions.dart';
|
|
import 'package:immich_mobile/extensions/string_extensions.dart';
|
|
|
|
void main() {
|
|
group('Test toDuration', () {
|
|
test('ok', () {
|
|
expect(
|
|
"1:02:33".toDuration(),
|
|
const Duration(hours: 1, minutes: 2, seconds: 33),
|
|
);
|
|
});
|
|
test('malformed', () {
|
|
expect("".toDuration(), isNull);
|
|
expect("1:2".toDuration(), isNull);
|
|
expect("a:b:c".toDuration(), isNull);
|
|
});
|
|
});
|
|
group('Test uniqueConsecutive', () {
|
|
test('empty', () {
|
|
final a = [];
|
|
expect(a.uniqueConsecutive(), []);
|
|
});
|
|
|
|
test('singleElement', () {
|
|
final a = [5];
|
|
expect(a.uniqueConsecutive(), [5]);
|
|
});
|
|
|
|
test('noDuplicates', () {
|
|
final a = [1, 2, 3];
|
|
expect(a.uniqueConsecutive(), orderedEquals([1, 2, 3]));
|
|
});
|
|
|
|
test('unsortedDuplicates', () {
|
|
final a = [1, 2, 1, 3];
|
|
expect(a.uniqueConsecutive(), orderedEquals([1, 2, 1, 3]));
|
|
});
|
|
|
|
test('sortedDuplicates', () {
|
|
final a = [6, 6, 2, 3, 3, 3, 4, 5, 1, 1];
|
|
expect(a.uniqueConsecutive(), orderedEquals([6, 2, 3, 4, 5, 1]));
|
|
});
|
|
|
|
test('withKey', () {
|
|
final a = ["a", "bb", "cc", "ddd"];
|
|
expect(
|
|
a.uniqueConsecutive(
|
|
compare: (s1, s2) => s1.length.compareTo(s2.length),
|
|
),
|
|
orderedEquals(["a", "bb", "ddd"]),
|
|
);
|
|
});
|
|
});
|
|
}
|