A whole lot of stuff
This commit is contained in:
parent
faf319322a
commit
ad850d2be6
50 changed files with 3013 additions and 213 deletions
|
|
@ -278,4 +278,35 @@ void main() {
|
|||
expect(byMonth[DateTime(2026, 3)]!.map((re) => re.entry.id), ['mar-1']);
|
||||
expect(byMonth[DateTime(2026, 4)]!.map((re) => re.entry.id), ['apr-1']);
|
||||
});
|
||||
|
||||
group('defaultReportDateRange', () {
|
||||
test('from August through year-end, defaults to July of that year through the following June',
|
||||
() {
|
||||
final (start, end) = defaultReportDateRange(DateTime(2026, 8, 17));
|
||||
expect(start, DateTime(2026, 7, 1));
|
||||
expect(end, DateTime(2027, 6, 30));
|
||||
});
|
||||
|
||||
test('from January through July, still defaults to the July before through this June', () {
|
||||
final (start, end) = defaultReportDateRange(DateTime(2027, 7, 15));
|
||||
expect(start, DateTime(2026, 7, 1));
|
||||
expect(end, DateTime(2027, 6, 30));
|
||||
});
|
||||
|
||||
test('the next cycle (August the following year) rolls the whole range forward a year', () {
|
||||
final (start, end) = defaultReportDateRange(DateTime(2027, 8, 1));
|
||||
expect(start, DateTime(2027, 7, 1));
|
||||
expect(end, DateTime(2028, 6, 30));
|
||||
});
|
||||
|
||||
test('July 31 is still the old cycle; August 1 is the new one', () {
|
||||
final stillOld = defaultReportDateRange(DateTime(2026, 7, 31));
|
||||
expect(stillOld.$1, DateTime(2025, 7, 1));
|
||||
expect(stillOld.$2, DateTime(2026, 6, 30));
|
||||
|
||||
final nowNew = defaultReportDateRange(DateTime(2026, 8, 1));
|
||||
expect(nowNew.$1, DateTime(2026, 7, 1));
|
||||
expect(nowNew.$2, DateTime(2027, 6, 30));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue