mirror of
https://github.com/immich-app/immich.git
synced 2024-12-30 11:28:22 +02:00
9ac087c59c
* fix(mobile): do not crash on malformed asset duration * add unit test
19 lines
462 B
Dart
19 lines
462 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:immich_mobile/utils/builtin_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(), null);
|
|
expect("1:2".toDuration(), null);
|
|
expect("a:b:c".toDuration(), null);
|
|
});
|
|
});
|
|
}
|