// SPDX-License-Identifier: 0BSD
import { mount } from "@vue/test-utils";
import { describe, it, expect, vi } from "vitest";
import ArchivesPage from "@/components/archives/ArchivesPage.vue";
function mountArchives() {
const routerPush = vi.fn();
return {
wrapper: mount(ArchivesPage, {
global: {
mocks: {
$t: (key) => key,
$router: { push: routerPush },
},
stubs: {
MaterialDesignIcon: true,
ArchiveSidebar: true,
},
},
}),
routerPush,
};
}
function randText(len) {
const alphabet = "abc<>\"'`\\/\u0000\n\r`topic_id=";
let s = "";
for (let i = 0; i < len; i++) {
s += alphabet[(Math.random() * alphabet.length) | 0];
}
return s;
}
describe("Archives page viewing-archive surface (security / fuzz)", () => {
const nastyPaths = [
"/page/article.mu`topic_id=40",
"/page/article.mu`topic_id=40`extra",
"/forum/thread.mu`sort=hot",
"/../../../etc/passwd",
"javascript:alert(1)",
"",
"a".repeat(6000),
];
const nastyContents = [
"
",
"