31 lines
1012 B
TypeScript
31 lines
1012 B
TypeScript
import { expect, test } from "bun:test"
|
|
import { newSessionLocation } from "../src/config/new-session-location"
|
|
|
|
test("uses the launch directory by default", () => {
|
|
expect(newSessionLocation("launch", "/launch", { directory: "/session", workspaceID: "work-1" })).toEqual({
|
|
directory: "/launch",
|
|
})
|
|
})
|
|
|
|
test("inherits the active session location when configured", () => {
|
|
expect(newSessionLocation("inherit", "/launch", { directory: "/session", workspaceID: "work-1" })).toEqual({
|
|
directory: "/session",
|
|
workspaceID: "work-1",
|
|
})
|
|
})
|
|
|
|
test("falls back to the launch directory without an active session", () => {
|
|
expect(newSessionLocation("inherit", "/launch")).toEqual({ directory: "/launch" })
|
|
})
|
|
|
|
test("does not inherit an unavailable active location", () => {
|
|
expect(
|
|
newSessionLocation(
|
|
"inherit",
|
|
"/launch",
|
|
{ directory: "/deleted", workspaceID: "work-1" },
|
|
{ directory: "/deleted", workspaceID: "work-1" },
|
|
),
|
|
).toEqual({ directory: "/launch" })
|
|
})
|