fix(launcher): Campaign LA LA3 narrow review fixes
This commit is contained in:
parent
26feba8186
commit
347a1a5d16
9 changed files with 495 additions and 145 deletions
|
|
@ -112,6 +112,19 @@ public sealed class StatusEventParserTests
|
|||
Assert.IsType<UnknownStatusEvent>(e);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("[]")]
|
||||
[InlineData("null")]
|
||||
[InlineData("42")]
|
||||
[InlineData("\"text\"")]
|
||||
public void CompleteJsonWithANonObjectRootSurfacesAsMalformedEvent(string line)
|
||||
{
|
||||
var e = StatusEventParser.Parse(line);
|
||||
|
||||
var malformed = Assert.IsType<MalformedStatusEvent>(e);
|
||||
Assert.Contains("root", malformed.Error, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
|
|
@ -136,6 +149,33 @@ public sealed class StatusEventParserTests
|
|||
Assert.IsType<UnknownStatusEvent>(e);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("{\"e\":\"started\",\"t\":\"2026-08-14T12:00:00Z\",\"sessionId\":\"s1\"}")]
|
||||
[InlineData("{\"v\":\"1\",\"e\":\"connected\",\"t\":\"2026-08-14T12:00:00Z\",\"sessionId\":\"s1\"}")]
|
||||
[InlineData("{\"v\":2,\"e\":\"started\",\"t\":\"2026-08-14T12:00:00Z\",\"sessionId\":\"s1\"}")]
|
||||
[InlineData("{\"v\":1,\"e\":\"connected\",\"sessionId\":\"s1\"}")]
|
||||
[InlineData("{\"v\":1,\"e\":\"started\",\"t\":42,\"sessionId\":\"s1\"}")]
|
||||
[InlineData("{\"v\":1,\"e\":\"connected\",\"t\":\"not-a-time\",\"sessionId\":\"s1\"}")]
|
||||
[InlineData("{\"v\":1,\"e\":\"started\",\"t\":\"2026-08-14T12:00:00+02:00\",\"sessionId\":\"s1\"}")]
|
||||
[InlineData("{\"v\":1,\"e\":\"connected\",\"t\":\"2026-08-14T12:00:00Z\"}")]
|
||||
[InlineData("{\"v\":1,\"e\":\"started\",\"t\":\"2026-08-14T12:00:00Z\",\"sessionId\":42}")]
|
||||
[InlineData("{\"v\":1,\"e\":\"connected\",\"t\":\"2026-08-14T12:00:00Z\",\"sessionId\":\"\"}")]
|
||||
public void PayloadFreeKnownEventsRequireTheFullPinnedV1Envelope(string line)
|
||||
{
|
||||
var e = StatusEventParser.Parse(line);
|
||||
|
||||
var malformed = Assert.IsType<MalformedStatusEvent>(e);
|
||||
Assert.False(string.IsNullOrWhiteSpace(malformed.Error));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("{\"v\":1,\"t\":\"2026-08-14T12:00:00Z\",\"sessionId\":\"s1\"}")]
|
||||
[InlineData("{\"v\":1,\"e\":42,\"t\":\"2026-08-14T12:00:00Z\",\"sessionId\":\"s1\"}")]
|
||||
public void MissingOrWrongKindEventNameSurfacesAsMalformedEvent(string line)
|
||||
{
|
||||
Assert.IsType<MalformedStatusEvent>(StatusEventParser.Parse(line));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void KnownEValueWithMissingRequiredFieldSurfacesAsMalformedEventRatherThanThrowing()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,6 +61,21 @@ public sealed class StatusFileTailerTests : IDisposable
|
|||
Assert.IsType<ConnectedStatusEvent>(events[1]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContinuesPastCompleteNonObjectJsonValuesToTheFollowingValidLine()
|
||||
{
|
||||
AppendShared(
|
||||
"[]\nnull\n42\n\"text\"\n"
|
||||
+ Line("connected", "s1"));
|
||||
var tailer = new StatusFileTailer(_path);
|
||||
|
||||
IReadOnlyList<StatusEvent> events = tailer.ReadNewEvents();
|
||||
|
||||
Assert.Equal(5, events.Count);
|
||||
Assert.All(events.Take(4), e => Assert.IsType<MalformedStatusEvent>(e));
|
||||
Assert.IsType<ConnectedStatusEvent>(events[4]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TolerateAPartialLastLineAndCompletesItOnALaterPoll()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue