1import { expect, it } from "vite-plus/test";
2import { findThreadSearchOccurrences } from "./threadSearch.ts";
3
4it("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
10it("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
16it("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});