diff options
| author | Adam <[email protected]> | 2026-02-06 05:51:01 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-06 05:51:01 -0600 |
| commit | 4afec6731d1051b6b7ea1f3a278c7e16b577736c (patch) | |
| tree | 70f0ddda33809ba21413e62afde9f429e21f3558 /packages/app/src/context/command.test.ts | |
| parent | 5d922198121338ba67ec1e809a57cf257889bb3c (diff) | |
| download | opencode-4afec6731d1051b6b7ea1f3a278c7e16b577736c.tar.gz opencode-4afec6731d1051b6b7ea1f3a278c7e16b577736c.zip | |
ignore: refactoring and tests (#12460)
Diffstat (limited to 'packages/app/src/context/command.test.ts')
| -rw-r--r-- | packages/app/src/context/command.test.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/app/src/context/command.test.ts b/packages/app/src/context/command.test.ts new file mode 100644 index 000000000..2b956287c --- /dev/null +++ b/packages/app/src/context/command.test.ts @@ -0,0 +1,25 @@ +import { describe, expect, test } from "bun:test" +import { upsertCommandRegistration } from "./command" + +describe("upsertCommandRegistration", () => { + test("replaces keyed registrations", () => { + const one = () => [{ id: "one", title: "One" }] + const two = () => [{ id: "two", title: "Two" }] + + const next = upsertCommandRegistration([{ key: "layout", options: one }], { key: "layout", options: two }) + + expect(next).toHaveLength(1) + expect(next[0]?.options).toBe(two) + }) + + test("keeps unkeyed registrations additive", () => { + const one = () => [{ id: "one", title: "One" }] + const two = () => [{ id: "two", title: "Two" }] + + const next = upsertCommandRegistration([{ options: one }], { options: two }) + + expect(next).toHaveLength(2) + expect(next[0]?.options).toBe(two) + expect(next[1]?.options).toBe(one) + }) +}) |
