Skip to repository content25 lines · 759 B · typescript
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T02:00:23.682Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
commandPalette.test.ts
1import { describe, expect, it } from "vitest";
2import { filterCommands, nextActiveIndex } from "./commandPalette";
3
4describe("command palette", () => {
5 it("wraps keyboard focus in both directions", () => {
6 expect(nextActiveIndex(2, "next", 3)).toBe(0);
7 expect(nextActiveIndex(0, "previous", 3)).toBe(2);
8 });
9
10 it("returns an honest empty state", () => {
11 expect(nextActiveIndex(0, "next", 0)).toBe(-1);
12 });
13
14 it("matches labels and keywords", () => {
15 const commands = [
16 { id: "new", label: "New note", keywords: ["create"], run() {} },
17 { id: "share", label: "Share note", keywords: ["invite"], run() {} },
18 ];
19
20 expect(filterCommands(commands, "invite").map(({ id }) => id)).toEqual([
21 "share",
22 ]);
23 });
24});
25