mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-22 22:33:01 +01:00
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.
70 lines
2.4 KiB
JavaScript
70 lines
2.4 KiB
JavaScript
/**
|
|
* @jest-environment node
|
|
*/
|
|
|
|
const path = require("node:path");
|
|
const extensionPlaywrightConfig = require("../../playwright.extension.config");
|
|
const {
|
|
ALLOW_CUSTOM_ARTIFACT_ENV,
|
|
REPOSITORY_EXTENSION_ARTIFACT,
|
|
selectedArtifact,
|
|
verifyPlaywrightExtensionArtifact,
|
|
} = require("./playwright-extension-global-setup");
|
|
|
|
test("the extension Playwright config always runs the artifact freshness gate", () => {
|
|
expect(extensionPlaywrightConfig.globalSetup).toBe(require.resolve("./playwright-extension-global-setup"));
|
|
});
|
|
|
|
test("the default Playwright target receives full repository artifact verification", () => {
|
|
const verifyArtifact = jest.fn(() => ({ kind: "repository" }));
|
|
|
|
expect(verifyPlaywrightExtensionArtifact({ env: {}, verifyArtifact })).toEqual({ kind: "repository" });
|
|
expect(selectedArtifact({})).toBe(REPOSITORY_EXTENSION_ARTIFACT);
|
|
expect(verifyArtifact).toHaveBeenCalledWith(undefined);
|
|
});
|
|
|
|
test("a custom artifact cannot silently bypass the repository build receipt", () => {
|
|
const customArtifact = path.resolve("test-results", "intentional-broken-extension");
|
|
const verifyArtifact = jest.fn();
|
|
|
|
expect(() =>
|
|
verifyPlaywrightExtensionArtifact({
|
|
env: { RYD_EXTENSION_ARTIFACT: customArtifact },
|
|
verifyArtifact,
|
|
}),
|
|
).toThrow(new RegExp(`${ALLOW_CUSTOM_ARTIFACT_ENV}=1`));
|
|
expect(verifyArtifact).not.toHaveBeenCalled();
|
|
});
|
|
|
|
test("an explicit custom-fixture opt-in still runs standalone artifact validation", () => {
|
|
const customArtifact = path.resolve("test-results", "intentional-broken-extension");
|
|
const verifyArtifact = jest.fn(() => ({ kind: "custom" }));
|
|
|
|
expect(
|
|
verifyPlaywrightExtensionArtifact({
|
|
env: {
|
|
[ALLOW_CUSTOM_ARTIFACT_ENV]: "1",
|
|
RYD_EXTENSION_ARTIFACT: customArtifact,
|
|
},
|
|
verifyArtifact,
|
|
}),
|
|
).toEqual({ kind: "custom" });
|
|
expect(verifyArtifact).toHaveBeenCalledWith(customArtifact);
|
|
});
|
|
|
|
test("truthy-looking custom-fixture values do not weaken the explicit gate", () => {
|
|
const customArtifact = path.resolve("test-results", "intentional-broken-extension");
|
|
|
|
for (const value of ["true", "yes", "0"]) {
|
|
expect(() =>
|
|
verifyPlaywrightExtensionArtifact({
|
|
env: {
|
|
[ALLOW_CUSTOM_ARTIFACT_ENV]: value,
|
|
RYD_EXTENSION_ARTIFACT: customArtifact,
|
|
},
|
|
verifyArtifact: jest.fn(),
|
|
}),
|
|
).toThrow(new RegExp(`${ALLOW_CUSTOM_ARTIFACT_ENV}=1`));
|
|
}
|
|
});
|