Skip to content

Commit

Permalink
Merge 63b2c88 into 1fde056
Browse files Browse the repository at this point in the history
  • Loading branch information
albertms10 authored Jan 27, 2023
2 parents 1fde056 + 63b2c88 commit e7ac3b9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/utils/date_time_extension_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,29 @@ void main() {
expect(DateTime(2021, 1, 10, 9, 30).toDouble(), closeTo(18637.3, 0.1));
});
});

group('.isToday', () {
test('should return whether this DateTime is today', () {
final dateTime = DateTime(1970, 1, 10, 9, 30);
expect(dateTime.isToday, isFalse);
expect(DateTime.now().isToday, isTrue);
});
});

group('.isYesterday', () {
test('should return whether this DateTime is yesterday', () {
expect(DateTime.now().isYesterday, isFalse);
final dateTime = DateTime.now().subtract(const Duration(days: 1));
expect(dateTime.isYesterday, isTrue);
});
});

group('.isTomorrow', () {
test('should return whether this DateTime is tomorrow', () {
expect(DateTime.now().isTomorrow, isFalse);
final dateTime = DateTime.now().add(const Duration(days: 1));
expect(dateTime.isTomorrow, isTrue);
});
});
});
}

0 comments on commit e7ac3b9

Please sign in to comment.