Allow deleting templates
This commit is contained in:
38
test/database/collections/recurrent.dart
Normal file
38
test/database/collections/recurrent.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:okane/database/collections/recurrent.dart';
|
||||
|
||||
void main() {
|
||||
group("isDue", () {
|
||||
test("null value", () {
|
||||
final t = RecurringTransaction()..lastExecution = null;
|
||||
expect(t.isDue(DateTime.now()), true);
|
||||
});
|
||||
|
||||
test("Date before", () {
|
||||
final now = DateTime.now();
|
||||
final t =
|
||||
RecurringTransaction()
|
||||
..lastExecution = now
|
||||
..days = 30;
|
||||
expect(t.isDue(now.add(Duration(days: 10))), false);
|
||||
});
|
||||
|
||||
test("Date before warning", () {
|
||||
final now = DateTime.now();
|
||||
final t =
|
||||
RecurringTransaction()
|
||||
..lastExecution = now
|
||||
..days = 30;
|
||||
expect(t.isDue(now.add(Duration(days: 20))), true);
|
||||
});
|
||||
|
||||
test("Expired", () {
|
||||
final now = DateTime.now();
|
||||
final t =
|
||||
RecurringTransaction()
|
||||
..lastExecution = now
|
||||
..days = 30;
|
||||
expect(t.isDue(now.add(Duration(days: 31))), true);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user