feat(shared): zod şemaları, Türkçe arama ve TL/tarih biçimleri
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { compareTr, foldTr, includesTr } from "./search";
|
||||
|
||||
describe("foldTr", () => {
|
||||
it("Türkçe harfleri ve büyük/küçük farkını normalize eder", () => {
|
||||
expect(foldTr("İrem")).toBe("irem");
|
||||
expect(foldTr("IŞIK")).toBe("isik");
|
||||
expect(foldTr("Ayşe Çağrı Öztürk Ünal")).toBe("ayse cagri ozturk unal");
|
||||
});
|
||||
});
|
||||
|
||||
describe("includesTr", () => {
|
||||
it("aksansız ve büyük harfli aramayla eşleşir", () => {
|
||||
expect(includesTr("İrem Güneş", "irem")).toBe(true);
|
||||
expect(includesTr("İrem Güneş", "GUNES")).toBe(true);
|
||||
expect(includesTr("Ayşe", "ayse")).toBe(true);
|
||||
expect(includesTr("Ayşe", "mehmet")).toBe(false);
|
||||
});
|
||||
|
||||
it("boş arama her şeyle eşleşir, boş değer hiçbir aramayla eşleşmez", () => {
|
||||
expect(includesTr("x", " ")).toBe(true);
|
||||
expect(includesTr(undefined, "a")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("compareTr", () => {
|
||||
it("Türk alfabesine göre sıralar", () => {
|
||||
expect(["Zeynep", "Çiğdem", "Can", "Şule", "Selin", "İrem", "Ilgın"].sort(compareTr)).toEqual([
|
||||
"Can",
|
||||
"Çiğdem",
|
||||
"Ilgın",
|
||||
"İrem",
|
||||
"Selin",
|
||||
"Şule",
|
||||
"Zeynep",
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user