mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-10-28 07:40:27 +01:00
e500088e65
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.
36 lines
1.3 KiB
JavaScript
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);
|
|
});
|