style(ui): format custom Presidio PII picker files

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Devin AI 2026-09-15 16:57:19 +00:00
parent 9f50d18ace
commit f147449374
3 changed files with 10 additions and 8 deletions

View file

@ -16,11 +16,8 @@ describe("normalizeCustomEntityName", () => {
describe("mergeCustomEntities", () => {
it("keeps supported order, dedupes, and appends unknown selected entities", () => {
expect(mergeCustomEntities(["PERSON", "EMAIL"], ["EMAIL", "NO_FODSELSNUMMER", "PERSON", "SE_PERSONNUMMER"])).toEqual([
"PERSON",
"EMAIL",
"NO_FODSELSNUMMER",
"SE_PERSONNUMMER",
]);
expect(
mergeCustomEntities(["PERSON", "EMAIL"], ["EMAIL", "NO_FODSELSNUMMER", "PERSON", "SE_PERSONNUMMER"]),
).toEqual(["PERSON", "EMAIL", "NO_FODSELSNUMMER", "SE_PERSONNUMMER"]);
});
});

View file

@ -1,5 +1,8 @@
export const normalizeCustomEntityName = (raw: string): string | null => {
const normalized = raw.trim().toUpperCase().replace(/[\s-]+/g, "_");
const normalized = raw
.trim()
.toUpperCase()
.replace(/[\s-]+/g, "_");
return normalized !== "" && /^[A-Z0-9_]+$/.test(normalized) ? normalized : null;
};

View file

@ -24,7 +24,9 @@ const PiiConfiguration: React.FC<PiiConfigurationProps> = ({
const allEntities = mergeCustomEntities(entities, selectedEntities);
const customEntities = allEntities.filter((entity) => !entities.includes(entity));
const categories =
customEntities.length > 0 ? [...entityCategories, { category: "Custom", entities: customEntities }] : entityCategories;
customEntities.length > 0
? [...entityCategories, { category: "Custom", entities: customEntities }]
: entityCategories;
// Create a lookup map to quickly find an entity's category
const entityToCategoryMap = new Map<string, string>();