CI / Build and test (pull_request) Successful in 11m47s
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 12s
CI / PostgreSQL 16 integration (pull_request) Successful in 10m37s
CI / PostgreSQL 17 integration (pull_request) Successful in 9m56s
CI / Docker image (pull_request) Successful in 1m48s
The Windows hands-on test of 1.1.0 found two things in Jobs. The log under a job showed UTC times (12:35) next to rows in local time (13:35): the stored log keeps UTC, so a server's jobs read right anywhere, and the desktop now dates the lines backwards from the job's end and shows them in local time. The Type column cut "Analisi approfondita" at a 0.7* share; a 1* share (90-170 px) fits it in a 1440 px window and still gives way at the 1200 px minimum. Builds without a release tag say 1.1.1; CHANGELOG [1.1.1], STATUS and DECISIONS updated. Refs #70 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
2.3 KiB
C#
49 lines
2.3 KiB
C#
using Chronos.App.Jobs;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.App.Tests.Jobs;
|
|
|
|
/// <summary>The job log stores UTC times; the Jobs table shows them in local time like the rows (#70).</summary>
|
|
public sealed class JobLogTimesTests
|
|
{
|
|
private static readonly TimeZoneInfo Rome = TimeZoneInfo.CreateCustomTimeZone("Test+1", TimeSpan.FromHours(1), "Test+1", "Test+1");
|
|
|
|
[Test]
|
|
public void LeadingTimesTurnLocal()
|
|
{
|
|
var finished = new DateTimeOffset(2026, 11, 16, 12, 40, 0, TimeSpan.Zero);
|
|
var tail = "12:35:04 Copying photos\n12:36:10 Done\nno time here";
|
|
Assert.Equal("13:35:04 Copying photos\n13:36:10 Done\nno time here", JobLogTimes.ToLocal(tail, finished, Rome));
|
|
}
|
|
|
|
[Test]
|
|
public void ALineBeforeMidnightBelongsToTheDayBefore()
|
|
{
|
|
// Finished at 00:10 UTC on the 17th: 23:58 is the 16th's, and both days convert with their own offset.
|
|
var finished = new DateTimeOffset(2026, 11, 17, 0, 10, 0, TimeSpan.Zero);
|
|
var zone = TimeZoneInfo.CreateCustomTimeZone("Test-5", TimeSpan.FromHours(-5), "Test-5", "Test-5");
|
|
Assert.Equal("18:58:00 Start\n19:05:00 End", JobLogTimes.ToLocal("23:58:00 Start\n00:05:00 End", finished, zone));
|
|
}
|
|
|
|
[Test]
|
|
public void ARunLongerThanADayDatesEachLineAcrossTheClockChange()
|
|
{
|
|
// Rome leaves summer time on 2026-10-25 at 01:00 UTC. A run from the 24th 10:00 UTC to the 25th 11:00 UTC: its
|
|
// first line is a day and more before the end, still in summer time (12:00), its last after the change (12:00).
|
|
var rome = TimeZoneInfo.FindSystemTimeZoneById("Europe/Rome");
|
|
var finished = new DateTimeOffset(2026, 10, 25, 12, 0, 0, TimeSpan.Zero);
|
|
var tail = "10:00:00 Start\n23:00:00 Midway\n11:00:00 End";
|
|
Assert.Equal("12:00:00 Start\n01:00:00 Midway\n12:00:00 End", JobLogTimes.ToLocal(tail, finished, rome));
|
|
}
|
|
|
|
[Test]
|
|
public void TextWithoutTimesStaysAsItIs()
|
|
{
|
|
var now = DateTimeOffset.UtcNow;
|
|
Assert.Equal(string.Empty, JobLogTimes.ToLocal(string.Empty, now, Rome));
|
|
Assert.Equal("1:2:3 short", JobLogTimes.ToLocal("1:2:3 short", now, Rome));
|
|
Assert.Equal("12:35:04", JobLogTimes.ToLocal("12:35:04", now, Rome));
|
|
Assert.Equal("ab:cd:ef text", JobLogTimes.ToLocal("ab:cd:ef text", now, Rome));
|
|
}
|
|
}
|