new-session-location.test.ts 1012 B

123456789101112131415161718192021222324252627282930
  1. import { expect, test } from "bun:test"
  2. import { newSessionLocation } from "../src/config/new-session-location"
  3. test("uses the launch directory by default", () => {
  4. expect(newSessionLocation("launch", "/launch", { directory: "/session", workspaceID: "work-1" })).toEqual({
  5. directory: "/launch",
  6. })
  7. })
  8. test("inherits the active session location when configured", () => {
  9. expect(newSessionLocation("inherit", "/launch", { directory: "/session", workspaceID: "work-1" })).toEqual({
  10. directory: "/session",
  11. workspaceID: "work-1",
  12. })
  13. })
  14. test("falls back to the launch directory without an active session", () => {
  15. expect(newSessionLocation("inherit", "/launch")).toEqual({ directory: "/launch" })
  16. })
  17. test("does not inherit an unavailable active location", () => {
  18. expect(
  19. newSessionLocation(
  20. "inherit",
  21. "/launch",
  22. { directory: "/deleted", workspaceID: "work-1" },
  23. { directory: "/deleted", workspaceID: "work-1" },
  24. ),
  25. ).toEqual({ directory: "/launch" })
  26. })