mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-30 17:14:40 +08:00
fix: harden OpenCode v1.14.48 integration
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
// kilocode_change - new file
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { TuiConfig } from "../../../../src/cli/cmd/tui/config/tui"
|
||||
import * as AppExit from "../../../../src/kilocode/tui/app-exit"
|
||||
|
||||
const prompt = (focused: boolean, input: string): AppExit.Prompt => ({
|
||||
focused,
|
||||
current: { input },
|
||||
})
|
||||
|
||||
describe("app_exit", () => {
|
||||
test("blocks every configured exit binding when the command matcher is disabled", () => {
|
||||
const bindings = TuiConfig.resolve({}).keybinds.gather("app_exit", ["app.exit"])
|
||||
|
||||
expect(bindings.length).toBeGreaterThan(0)
|
||||
for (const binding of bindings) expect(AppExit.enabled(false)).toBe(false)
|
||||
})
|
||||
|
||||
test("permits exit without a prompt ref", () => {
|
||||
expect(AppExit.enabled(true)).toBe(true)
|
||||
})
|
||||
|
||||
test("blocks focused prompts with non-empty input including whitespace", () => {
|
||||
expect(AppExit.enabled(true, prompt(true, "keep typing"))).toBe(false)
|
||||
expect(AppExit.enabled(true, prompt(true, " "))).toBe(false)
|
||||
})
|
||||
|
||||
test("permits focused empty and unfocused prompts", () => {
|
||||
expect(AppExit.enabled(true, prompt(true, ""))).toBe(true)
|
||||
expect(AppExit.enabled(true, prompt(false, "keep typing"))).toBe(true)
|
||||
})
|
||||
|
||||
test("registers slash exit independently of binding enablement", () => {
|
||||
let exited = false
|
||||
const command = AppExit.command(() => {
|
||||
exited = true
|
||||
})
|
||||
|
||||
expect(command).toMatchObject({
|
||||
name: "app.exit",
|
||||
slashName: "exit",
|
||||
slashAliases: ["quit", "q"],
|
||||
})
|
||||
command.run()
|
||||
expect(exited).toBe(true)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user