mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-12-07 19:59:07 +00:00
fix(mobile): do not crash on malformed asset duration (#1921)
* fix(mobile): do not crash on malformed asset duration * add unit test
This commit is contained in:
committed by
GitHub
parent
f52e076cb3
commit
9ac087c59c
18
mobile/test/builtin_extensions_text.dart
Normal file
18
mobile/test/builtin_extensions_text.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user