embedded-search-shell.test.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { describe, expect, it } from "vitest";
  2. import type { ExecutionShellSelection } from "@zcode/contracts";
  3. import { supportsEmbeddedSearchShellSelection } from "../src/embedded-search/shell.js";
  4. describe("supportsEmbeddedSearchShellSelection", () => {
  5. it("supports POSIX and Git Bash session shells for runtime prelude injection", () => {
  6. expect(supportsEmbeddedSearchShellSelection(undefined)).toBe(false);
  7. expect(
  8. supportsEmbeddedSearchShellSelection({
  9. dialect: "posix",
  10. display: { name: "bash" },
  11. path: "/bin/bash",
  12. source: "auto-detected",
  13. } satisfies ExecutionShellSelection),
  14. ).toBe(true);
  15. expect(
  16. supportsEmbeddedSearchShellSelection({
  17. dialect: "git-bash",
  18. display: { name: "Git Bash" },
  19. path: "C:\\Program Files\\Git\\bin\\bash.exe",
  20. source: "auto-detected",
  21. } satisfies ExecutionShellSelection),
  22. ).toBe(true);
  23. expect(
  24. supportsEmbeddedSearchShellSelection({
  25. dialect: "cmd",
  26. display: { name: "CMD" },
  27. path: "cmd.exe",
  28. source: "user-config",
  29. } satisfies ExecutionShellSelection),
  30. ).toBe(false);
  31. expect(
  32. supportsEmbeddedSearchShellSelection({
  33. dialect: "legacy-shell",
  34. display: { name: "system shell" },
  35. source: "legacy-fallback",
  36. } satisfies ExecutionShellSelection),
  37. ).toBe(false);
  38. });
  39. });