Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

threadFindActionBus.test.ts

22 lines869 Bytes

1import { MessageId } from "@t3tools/contracts";
2import { describe, expect, it } from "vite-plus/test";
3​
4import { findForMessageMatch } from "./threadFindActionBus";
5​
6describe("findForMessageMatch", () => {
7 it("opens find on the longest word as the snippet writes it, at the matched message", () => {
8 expect(
9 findForMessageMatch(
10 { snippet: "The cafeteria, then the Café", messageId: MessageId.make("message-1") },
11 "cafe",
12 ),
13 ).toEqual({ query: "Café", start: { entryId: "message-1", occurrence: 0 } });
14 expect(findForMessageMatch({ snippet: "fix the sidebar lag" }, "fix sidebar")).toEqual({
15 query: "sidebar",
16 });
17 // The whole query, when the snippet holds it as typed.
18 expect(findForMessageMatch({ snippet: "then Vp run dev again" }, "vp run dev")).toEqual({
19 query: "Vp run dev",
20 });
21 });
22});