Hydrate terminal drawer with current log history

This commit is contained in:
npc0-hue
2026-09-09 15:02:39 +08:00
parent f88123e185
commit 892c6d843f
2 changed files with 57 additions and 1 deletions
@@ -89,6 +89,23 @@ describe("ServerManagementTerminalDrawer", () => {
expect(apiMocks.dispatchSourceRCONCommand).not.toHaveBeenCalled();
});
it("hydrates recent current-session output when the terminal opens after Run already attached", async () => {
const currentStream = logStream("stdout-current", "session-current", "process.stdout");
currentStream.latestSeq = 900;
apiMocks.queryLogStream.mockResolvedValueOnce({ logStreamId: currentStream.id, entries: [logEntry(899, "existing SCUM output before drawer opened", "2026-08-14T00:14:59Z"), logEntry(900, "latest SCUM output before drawer opened", "2026-08-14T00:15:00Z")], nextSeq: 901, latestSeq: 900 });
await renderDrawer();
await emitSession("session-current");
await emitStream(currentStream);
await emitReady();
await flushPromises();
expect(container?.textContent).toContain("existing SCUM output before drawer opened");
expect(container?.textContent).toContain("latest SCUM output before drawer opened");
expect(apiMocks.queryLogStream).toHaveBeenCalledWith({ logStreamId: currentStream.id, afterSeq: 400, limit: 500 });
expect(apiMocks.listLogStreams).not.toHaveBeenCalled();
});
it("uses the server-provided clock for terminal system lines", async () => {
const serverTime = "2001-02-03T04:05:06Z";
await renderDrawer();