Files
govoplan-campaign/webui/tests/recipient-search-ui-structure.test.mjs

29 lines
1019 B
JavaScript

import { readFileSync } from "node:fs";
const source = readFileSync(
new URL("../src/features/campaigns/RecipientDataPage.tsx", import.meta.url),
"utf8"
).replace(/\s+/g, " ");
function assertIncludes(fragment, message) {
if (!source.includes(fragment.replace(/\s+/g, " "))) throw new Error(message);
}
for (const field of ["from", "reply_to", "to", "cc", "bcc"]) {
assertIncludes(`key: "${field}"`, `recipient search must retain the ${field} address category`);
}
assertIncludes(
"recipientAddressOverlayColumns. flatMap((column) => getEntryAddresses(entry, column.key))",
"recipient filtering must search every configured address category"
);
assertIncludes(
"onQueryChange={setRecipientProfilesQuery}",
"the recipient page must observe the shared DataGrid filter"
);
assertIncludes(
"Matched in {hiddenMatch.label}: {hiddenMatch.address}",
"a row must explain when its match came from a hidden address"
);
console.log("Campaign recipient search covers and explains hidden address matches.");