Files
Anarios e500088e65 Prepare 4.0.5 Firefox update and Shorts fixes
Add Firefox data consent, repair contributor sign-in, and introduce optional Hide clutter buttons. Harden video navigation, voting, and action layouts with shared browser regression coverage and reproducible release packaging.
2026-09-06 12:51:12 +02:00

36 lines
1.3 KiB
JavaScript

const { assertExactSuccessfulVotesTraffic } = require("./hermetic-api-contract");
const VIDEO_A = "abcdefghijk";
const VIDEO_B = "zyxwvutsrqp";
function votes(videoId, overrides = {}) {
return {
method: "GET",
pathname: "/votes",
query: { videoId },
respondedAt: 123,
responseStatus: 200,
...overrides,
};
}
test("accepts the exact ordered successful /votes sequence", () => {
const records = [
{ method: "GET", pathname: "/configs/selectors", responseStatus: 200 },
votes(VIDEO_A),
votes(VIDEO_B),
];
expect(assertExactSuccessfulVotesTraffic(records, [VIDEO_A, VIDEO_B])).toEqual(records.slice(1));
});
test.each([
["missing request", [votes(VIDEO_A)], /missing, duplicate, or stale/],
["duplicate request", [votes(VIDEO_A), votes(VIDEO_B), votes(VIDEO_B)], /missing, duplicate, or stale/],
["stale video ID", [votes(VIDEO_A), votes("stalevid001")], /missing, duplicate, or stale/],
["non-200 response", [votes(VIDEO_A), votes(VIDEO_B, { responseStatus: 204 })], /did not receive HTTP 200/],
["unfinished response", [votes(VIDEO_A), votes(VIDEO_B, { respondedAt: undefined })], /did not finish/],
])("rejects a %s", (_label, records, expectedError) => {
expect(() => assertExactSuccessfulVotesTraffic(records, [VIDEO_A, VIDEO_B], "Shared runtime")).toThrow(expectedError);
});