Skip to content

Commit

Permalink
Remove duplicated features folder in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 authored and hoangdat committed Aug 28, 2024
1 parent ef90aac commit ee94b9a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:date_format/date_format.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:date_format/date_format.dart' as date_format;
import 'package:jmap_dart_client/jmap/core/utc_date.dart';
import 'package:jmap_dart_client/jmap/mail/calendar/calendar_event.dart';
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_event_extension.dart';

void main() {
group('calendar event extension test', () {
group('calendar_event_extension::formatDateTime::test', () {
final dateTime = DateTime(2021, 10, 10, 10, 30, 00, 00, 00);

const locale = date_format.EnglishDateLocale();
Expand All @@ -27,4 +29,48 @@ void main() {
expect(formattedTime, expectedFormattedTime);
});
});

group('calendar_event_extension::dateTimeEventAsString::test', () {
test('dateTimeEventAsString should return string with format start date - end date (timezone offset) and date formatted as DD, MM dd, YYYY for all-day event for many days', () {
const expectedFormattedDateString = 'Sunday, October 10, 2021 - Sunday, October 24, 2021 (GMT+0)';

final startDate = DateTime(2021, 10, 10, 00, 00, 00, 00, 00);
final endDate = DateTime(2021, 10, 25, 00, 00, 00, 00, 00);

final calendarEvent = CalendarEvent(
startDate: startDate,
endDate: endDate,
startUtcDate: UTCDate(startDate),
endUtcDate: UTCDate(endDate),
);

final formattedDateString = calendarEvent.getDateTimeEvent(
timeZone: 'GMT+0',
dateLocale: const EnglishDateLocale()
);

expect(formattedDateString, expectedFormattedDateString);
});

test('dateTimeEventAsString should return string with format date (timezone offset) and date formatted as DD, MM dd, YYYY for all-day event for one day', () {
const expectedFormattedDateString = 'Sunday, October 10, 2021 (GMT+0)';

final startDate = DateTime(2021, 10, 10, 00, 00, 00, 00, 00);
final endDate = DateTime(2021, 10, 11, 00, 00, 00, 00, 00);

final calendarEvent = CalendarEvent(
startDate: startDate,
endDate: endDate,
startUtcDate: UTCDate(startDate),
endUtcDate: UTCDate(endDate),
);

final formattedDateString = calendarEvent.getDateTimeEvent(
timeZone: 'GMT+0',
dateLocale: const EnglishDateLocale()
);

expect(formattedDateString, expectedFormattedDateString);
});
});
}

This file was deleted.

0 comments on commit ee94b9a

Please sign in to comment.