test(browser): distinguish partial HTTP samples from closed inventories

This commit is contained in:
morluto committed 2026-10-24 08:22:14 +08:00
1 parent 934f538f64
commit 4118004348
1 file changed
+42 -3
@@ -96,8 +96,17 @@ describe("HTTP comparison response coverage", () => {
[response],
[{ ...response, status: 500 }],
);
expect(compareNetwork(before, after)).toMatchObject({
status: "unknown",
total_changes: 0,
changes: [],
});
// A finite imported inventory supplies correspondence; passive samples
// alone cannot pair repeated same-URL transactions by transient CDP ID.
markNetworkInventoriesComplete(before, after);
expect(compareNetwork(before, after)).toMatchObject({
status: "changed",
total_changes: 1,
changes: [expect.objectContaining({ change: "modified" })],
});
});
@@ -110,7 +119,17 @@ describe("HTTP comparison response coverage", () => {
[{ ...response, encodedDataLength: 100 }],
[{ ...response, ...change }],
);
expect(compareNetwork(before, after).status).toBe("changed");
expect(compareNetwork(before, after)).toMatchObject({
status: "unknown",
total_changes: 0,
changes: [],
});
markNetworkInventoriesComplete(before, after);
expect(compareNetwork(before, after)).toMatchObject({
status: "changed",
total_changes: 1,
changes: [expect.objectContaining({ change: "modified" })],
});
});
});
@@ -145,7 +164,17 @@ describe("HTTP comparison repeated request coverage", () => {
{ ...response, requestId: "first-after", encodedDataLength: 100 },
],
);
expect(compareNetwork(before, after).status).toBe("changed");
expect(compareNetwork(before, after)).toMatchObject({
status: "unknown",
total_changes: 0,
changes: [],
});
markNetworkInventoriesComplete(before, after);
expect(compareNetwork(before, after)).toMatchObject({
status: "changed",
total_changes: 1,
changes: [expect.objectContaining({ change: "modified" })],
});
});
it("preserves the association between complete response fields", async () => {
@@ -169,7 +198,17 @@ describe("HTTP comparison repeated request coverage", () => {
},
],
);
expect(compareNetwork(before, after).status).toBe("changed");
expect(compareNetwork(before, after)).toMatchObject({
status: "unknown",
total_changes: 0,
changes: [],
});
markNetworkInventoriesComplete(before, after);
expect(compareNetwork(before, after)).toMatchObject({
status: "changed",
total_changes: 1,
changes: [expect.objectContaining({ change: "modified" })],
});
});
});