Skip to content

Commit

Permalink
Add TimeOfDay and DateTime extension tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vyPal committed Sep 15, 2023
1 parent 3b19e0f commit 8b461c0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:eduapge2/home.dart';
import 'package:eduapge2/login.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -38,6 +39,20 @@ void main() {
expect(prefs.get("email"), equals(username));
expect(prefs.get("password"), equals(password));
});

group('TimeOfDay', () {
TimeOfDay time1 = const TimeOfDay(hour: 4, minute: 20);
TimeOfDay time2 = const TimeOfDay(hour: 6, minute: 09);
test('is lesser', () => {expect(time1 < time2, true)});
test('is lesser or equal', () => {expect(time1 <= time1, true)});
test('is greater', () => {expect(time2 > time1, true)});
});

group('DateTime', () {
DateTime parsed = DateTimeExtension.parseTime("4:20");
test(
'parseTime', () => {expect(parsed.hour, 4), expect(parsed.minute, 20)});
});
}

class LocalizationsInj extends StatelessWidget {
Expand Down

0 comments on commit 8b461c0

Please sign in to comment.