refactor: remove residual normalization adapters (#122771)

This commit is contained in:
Peter Steinberger
2026-08-12 11:51:45 -07:00
committed by GitHub
parent 8bbc0a9bc7
commit 9da43d67e1
14 changed files with 57 additions and 98 deletions
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
import {
filterStringEntries,
normalizeAtHashSlug,
normalizeCsvOrLooseStringList,
normalizeHyphenSlug,
normalizeOptionalTrimmedStringList,
normalizeSortedUniqueStringEntries,
@@ -82,6 +83,15 @@ describe("normalization-core/string-normalization", () => {
expect(normalizeOptionalTrimmedStringList(["", 42])).toBeUndefined();
});
it.each([
{ value: " first, second, , first ", expected: ["first", "second", "first"] },
{ value: [" first ", 42, "", " ", 7], expected: ["first", "42", "7"] },
{ value: null, expected: [] },
{ value: { value: "first" }, expected: [] },
])("normalizes CSV or loose string-list input", ({ value, expected }) => {
expect(normalizeCsvOrLooseStringList(value)).toEqual(expected);
});
it("normalizes sorted unique trimmed string lists", () => {
expect(normalizeSortedUniqueTrimmedStringList([" b ", "a", "b", "", "a"])).toEqual(["a", "b"]);
expect(normalizeSortedUniqueTrimmedStringList(["z", 1, " a "] as unknown[])).toEqual([