Skip to content

Commit

Permalink
fix(replies): amend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mforesti authored and borgoat committed Nov 10, 2024
1 parent 0858d35 commit a18f03f
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions test/schedules_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,38 @@ void main() {
group('schedules instances', () {
test('basic setup with default replies and overrides', () {
const testDays = 10;
final startDate = DateTime.now().getDayStart();
final startDate = DateTime(2000, 1, 1).toUtc();
final endDate = startDate.add(const Duration(days: testDays));

final recurrenceRule = CommonRecurrenceRules.daily;
final schedule = Schedule(
final dailyRecurrenceRule = CommonRecurrenceRules.daily;
final dailySchedule = Schedule(
id: 1,
groupId: 1,
displayName: 'Daily schedule',
startDate: startDate,
recurrenceRule: dailyRecurrenceRule);
final weekendRecurrenceRule = CommonRecurrenceRules.weekends;
final weekendSchedule = Schedule(
id: 2,
groupId: 1,
displayName: 'Test schedule',
displayName: 'Weekend schedule',
startDate: startDate,
recurrenceRule: recurrenceRule);
recurrenceRule: weekendRecurrenceRule);

final dailyRecurrenceRule = CommonRecurrenceRules.daily;
final weekendRecurrenceRule = CommonRecurrenceRules.weekends;
final defaultReplies = [
DefaultReply(
memberId: 32,
scheduleId: schedule.id,
scheduleId: dailySchedule.id,
selectedOption: ReplyOptions.yes,
recurrenceRule: dailyRecurrenceRule),
DefaultReply(
memberId: 32,
scheduleId: weekendSchedule.id,
selectedOption: ReplyOptions.yes,
recurrenceRule: weekendRecurrenceRule),
DefaultReply(
memberId: 33,
scheduleId: schedule.id,
scheduleId: dailySchedule.id,
selectedOption: ReplyOptions.yes,
recurrenceRule: weekendRecurrenceRule),
];
Expand All @@ -43,23 +53,28 @@ void main() {
final replies = [
Reply(
memberId: 32,
scheduleId: schedule.id,
scheduleId: dailySchedule.id,
eventDate: sunday,
selectedOption: ReplyOptions.no),
Reply(
memberId: 33,
scheduleId: schedule.id,
scheduleId: dailySchedule.id,
eventDate: sunday,
selectedOption: ReplyOptions.no),
Reply(
memberId: 32,
scheduleId: schedule.id,
scheduleId: dailySchedule.id,
eventDate: saturday,
selectedOption: ReplyOptions.no),
Reply(
memberId: 32,
scheduleId: weekendSchedule.id,
eventDate: sunday,
selectedOption: ReplyOptions.yes),
];

final result = getScheduleInstances(
schedule: schedule,
schedule: dailySchedule,
defaultReplies: defaultReplies,
replies: replies,
startDate: startDate,
Expand Down

0 comments on commit a18f03f

Please sign in to comment.