Skip to content

Commit

Permalink
✅ Some tests are failing midnight due to timezone issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
TDroogers committed Sep 29, 2024
1 parent 52862b0 commit 5835b73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public void NoNameButDayTest([Frozen] IStringLocalizer<App> L)

var training = new TrainingAdvance { DateStart = DateTime.UtcNow };
var cut = RenderComponent<CalendarBaseCard>(parameter => parameter.Add(p => p.Training, training).Add(p => p.ReplaceEmptyName, true));
cut.Markup.Should().Contain(training.DateStart.ToLocalTime().ToString("dddd"));
var timeZone = "Europe/Amsterdam";
var zone = TimeZoneInfo.FindSystemTimeZoneById(timeZone);
var dateStart = TimeZoneInfo.ConvertTimeFromUtc(training.DateStart, zone);
cut.Markup.Should().Contain(dateStart.ToString("dddd"));
}

[Theory]
Expand Down Expand Up @@ -96,6 +99,7 @@ public void OnClickHistoryAndSettingsTest([Frozen] IStringLocalizer<App> L)
}

private bool Clicked = false;

private void ClickButton()
{
Clicked = true;
Expand All @@ -106,4 +110,4 @@ private void Localize(IStringLocalizer<App> L1)
Services.AddSingleton(L1);
A.CallTo(() => L1["till"]).Returns(new LocalizedString("till", "till with some more text to ensure it is replaced"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ protected async Task<Guid> AddDefaultSchedule()
TimeStart = new TimeOnly(11, 0),
TimeEnd = new TimeOnly(14, 0),
ValidFromDefault = DateTime.Today,
ValidUntilDefault = DateTime.Today.AddDays(7),
ValidUntilDefault = DateTime.Today.AddDays(14),
CountToTrainingTarget = false,
Order = 10
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ public async Task PutScheduleToNewGroupTest()
Assert.NotNull(patchResult.Value?.Patched?.UserDefaultAvailableId);

var allForGroup = await DefaultScheduleController.GetAllByGroupId(newGroup.Id);
Assert.NotNull(allForGroup.Value?.DefaultSchedules);
Assert.NotEmpty(allForGroup.Value.DefaultSchedules);
allForGroup.Value!.DefaultSchedules!.FirstOrDefault(x => x.Id == DefaultDefaultSchedule)!.UserSchedules.Should().Contain(x => x.UserDefaultAvailableId == patchResult.Value!.Patched!.UserDefaultAvailableId);

var idDefaultGroup = (await DefaultScheduleController.GetAllGroups()).Value!.Groups!.FirstOrDefault(x => x.IsDefault)!.Id;
Expand Down

0 comments on commit 5835b73

Please sign in to comment.