chore: refactoring and tests, splitting up files (#12495)

This commit is contained in:
Adam
2026-02-06 10:02:31 -06:00
committed by GitHub
parent a4bc883595
commit 2c58dd6203
117 changed files with 9457 additions and 5827 deletions
@@ -0,0 +1,44 @@
import { describe, expect, test } from "bun:test"
import { canAddSelectionContext } from "./session-command-helpers"
describe("canAddSelectionContext", () => {
test("returns false without active tab", () => {
expect(
canAddSelectionContext({
active: undefined,
pathFromTab: () => "src/a.ts",
selectedLines: () => ({ start: 1, end: 1 }),
}),
).toBe(false)
})
test("returns false when active tab is not a file", () => {
expect(
canAddSelectionContext({
active: "context",
pathFromTab: () => undefined,
selectedLines: () => ({ start: 1, end: 1 }),
}),
).toBe(false)
})
test("returns false without selected lines", () => {
expect(
canAddSelectionContext({
active: "file://src/a.ts",
pathFromTab: () => "src/a.ts",
selectedLines: () => null,
}),
).toBe(false)
})
test("returns true when file and selection exist", () => {
expect(
canAddSelectionContext({
active: "file://src/a.ts",
pathFromTab: () => "src/a.ts",
selectedLines: () => ({ start: 1, end: 2 }),
}),
).toBe(true)
})
})