mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-19 15:06:53 +00:00

* feat: wip timer field * feat: timer field fixing errors * feat: wip timer field frontend * fix: parsing TimerCellDataPB * feat: parse time string to minutes * fix: don't allow none number input * fix: timer filter * style: cargo fmt * fix: clippy errors * refactor: rename field type timer to time * refactor: missed some variable and files to rename * style: cargo fmt fix * feat: format time field type data in frontend * style: fix cargo fmt * fix: fixes after merge --------- Co-authored-by: Mathias Mogensen <mathiasrieckm@gmail.com>
25 lines
757 B
Dart
25 lines
757 B
Dart
import 'package:appflowy/util/time.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test('parseTime should parse time string to minutes', () {
|
|
expect(parseTime('10'), 10);
|
|
expect(parseTime('70m'), 70);
|
|
expect(parseTime('4h 20m'), 260);
|
|
expect(parseTime('1h 80m'), 140);
|
|
expect(parseTime('asffsa2h3m'), null);
|
|
expect(parseTime('2h3m'), null);
|
|
expect(parseTime('blah'), null);
|
|
expect(parseTime('10a'), null);
|
|
expect(parseTime('2h'), 120);
|
|
});
|
|
|
|
test('formatTime should format time minutes to formatted string', () {
|
|
expect(formatTime(5), "5m");
|
|
expect(formatTime(75), "1h 15m");
|
|
expect(formatTime(120), "2h");
|
|
expect(formatTime(-50), "");
|
|
expect(formatTime(0), "0m");
|
|
});
|
|
}
|