From dbf8e1eacc22da774ce4e373ffd6499bae2060f1 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sat, 24 Oct 2026 06:29:22 +0800 Subject: [PATCH] test(browser): cover SAZ capture-level null member limitation --- src/browser/history/NodeCaptureAdapter.test.ts | 7 +++++++ tests/boundary/browser/sazWebCapture.test.ts | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/browser/history/NodeCaptureAdapter.test.ts b/src/browser/history/NodeCaptureAdapter.test.ts index 3e47e09731..1e224a2ef8 100644 --- a/src/browser/history/NodeCaptureAdapter.test.ts +++ b/src/browser/history/NodeCaptureAdapter.test.ts @@ -2,6 +2,13 @@ import { expect, it, vi } from "vitest"; import { AnalysisCapabilityUnavailableError } from "../../domain/analysisErrorCore.js"; import { NodeCaptureAdapter } from "./NodeCaptureAdapter.js"; +it.each(["har", "qlog"] as const)( + "keeps SAZ-specific limitations out of %s captures", + (format) => { + expect(new NodeCaptureAdapter(format).limitations).toEqual([]); + }, +); + vi.mock("./CaptureRelease.js", async (original) => ({ ...(await original()), NODE_CAPTURE_HEAP_ENFORCED: false, diff --git a/tests/boundary/browser/sazWebCapture.test.ts b/tests/boundary/browser/sazWebCapture.test.ts index ef4081a4da..1b5fff10c6 100644 --- a/tests/boundary/browser/sazWebCapture.test.ts +++ b/tests/boundary/browser/sazWebCapture.test.ts @@ -640,13 +640,18 @@ it("reports zero-byte SAZ HTTP members as null instead of rejecting the archive" (await cli(path)).normalized_result, ); expect(capture.total_records).toBe(2); + expect(capture.limitations).toContainEqual( + expect.stringMatching( + /\babsent\b[^.]*\bzero-byte\b[^.]*\bHTTP members\b[^.]*\bnull\b/iu, + ), + ); expect(capture.records[0]?.reported).toMatchObject({ - request: { method: "GET" }, + request: { method: "GET", body: "" }, response: null, }); expect(capture.records[1]?.reported).toMatchObject({ request: null, - response: { status: "204" }, + response: { status: "204", body: "" }, websocket: { member: "raw/2_w.txt" }, }); expect(capture.records[0]?.location).toEqual({