Add server-backed file property filters
This commit is contained in:
36
webui/scripts/test-file-property-filters-structure.mjs
Normal file
36
webui/scripts/test-file-property-filters-structure.mjs
Normal file
@@ -0,0 +1,36 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
const page = readFileSync(new URL("../src/features/files/FilesPage.tsx", import.meta.url), "utf8").replace(/\s+/g, " ");
|
||||
const api = readFileSync(new URL("../src/api/files.ts", import.meta.url), "utf8").replace(/\s+/g, " ");
|
||||
|
||||
function assertIncludes(source, fragment, message) {
|
||||
if (!source.includes(fragment.replace(/\s+/g, " "))) throw new Error(message);
|
||||
}
|
||||
|
||||
assertIncludes(
|
||||
api,
|
||||
"campaign_usage?: FileCampaignUsageFilter; audit_relevant?: boolean;",
|
||||
"the Files API must expose structured campaign and audit filters"
|
||||
);
|
||||
assertIncludes(
|
||||
api,
|
||||
"do { const response = await listFiles",
|
||||
"property filtering must traverse every server result page"
|
||||
);
|
||||
assertIncludes(
|
||||
page,
|
||||
"if (propertyFiltersActive && propertyFilterResults) return propertyFilterResults;",
|
||||
"server-filtered rows must replace, not narrow, the currently loaded explorer window"
|
||||
);
|
||||
assertIncludes(
|
||||
page,
|
||||
'<option value="unlinked">Not linked or used</option>',
|
||||
"the high-priority unlinked campaign-file filter must remain available"
|
||||
);
|
||||
assertIncludes(
|
||||
page,
|
||||
"setPropertyFilterTotal(response.total);",
|
||||
"the UI must retain the exact server-side filtered count"
|
||||
);
|
||||
|
||||
console.log("Files property filters cover the complete server result window.");
|
||||
Reference in New Issue
Block a user