The best way to control Claude Code, Codex and more from any computer or phone

main
ts 26 lines 1.25 KB
Raw
1 import { expect, it } from "vite-plus/test";
2 import { findThreadSearchOccurrences } from "./threadSearch.ts";
3
4 it("finds non-overlapping occurrences without invalidating Unicode offsets", () => {
5 expect(findThreadSearchOccurrences("Deploy the Deployment", "deploy")).toEqual([0, 11]);
6 expect(findThreadSearchOccurrences("aaaa", "aa")).toEqual([0, 2]);
7 expect(findThreadSearchOccurrences("İİİ needle", "needle")).toEqual([4]);
8 });
9
10 it("matches both Greek sigma forms without changing source offsets", () => {
11 expect(findThreadSearchOccurrences("ΟΣ ος οσ", "Σ")).toEqual([1, 4, 7]);
12 expect(findThreadSearchOccurrences("ΟΣ ος οσ", "ς")).toEqual([1, 4, 7]);
13 expect(findThreadSearchOccurrences("İ ΟΣ", "Σ")).toEqual([3]);
14 });
15
16 it("matches straight and curly apostrophes without changing source offsets", () => {
17 expect(findThreadSearchOccurrences("don't don’t", "don’t")).toEqual([0, 6]);
18 expect(findThreadSearchOccurrences("İ don‘t", "don't")).toEqual([2]);
19 });
20
21 it("matches dotted capital I without changing source offsets", () => {
22 expect(findThreadSearchOccurrences("📍 İstanbul ıstanbul i\u0307stanbul", "istanbul")).toEqual([
23 3,
24 ]);
25 expect(findThreadSearchOccurrences("Istanbul istanbul", "İSTANBUL")).toEqual([0, 9]);
26 });