Files
EpicNext-Cms/src/features/catalog/domain/search.test.ts
T
Simo 193b6686a9
CI / check (push) Successful in 1m16s
CI / deploy (push) Successful in 28s
refactor(catalog): unify commands and embed guarded catalog workspace
2026-09-06 19:40:52 +02:00

19 lines
666 B
TypeScript

import { describe, expect, it } from "vitest";
import { parseCatalogSearch, validSearchQuery } from "./search";
describe("catalog search input", () => {
it("allows a one digit ID but requires at least two text characters", () => {
expect(validSearchQuery("7")).toBe(true);
expect(validSearchQuery("a")).toBe(false);
expect(validSearchQuery(" ab ")).toBe(true);
});
it("does not round oversized numeric identifiers", () => {
expect(parseCatalogSearch("normal", "9007199254740992").numericId).toBe(
null,
);
});
it("escapes LIKE wildcard and escape characters", () => {
expect(parseCatalogSearch("bc", "a_%=").pattern).toBe("a=_=%==%");
});
});