Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { resolveComposerMenuActiveItemId } from "./composerMenuHighlight";
4
5describe("resolveComposerMenuActiveItemId", () => {
6 it("clears the active result while async results are empty and resolves against restored results", () => {
7 const search = {
8 highlightedItemId: "second",
9 currentSearchKey: "path:src",
10 highlightedSearchKey: "path:src",
11 };
12 const cleared = resolveComposerMenuActiveItemId({ ...search, items: [] });
13 expect(cleared).toBeNull();
14 expect(
15 resolveComposerMenuActiveItemId({
16 ...search,
17 highlightedItemId: cleared,
18 items: [{ id: "new-result" }, { id: "second" }],
19 }),
20 ).toBe("new-result");
21 });
22});