1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-30 11:28:22 +02:00
immich/mobile/test/builtin_extensions_text.dart
Fynn Petersen-Frey 9ac087c59c
fix(mobile): do not crash on malformed asset duration (#1921)
* fix(mobile): do not crash on malformed asset duration

* add unit test
2023-03-06 09:27:01 -06:00

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);
});
});
}