appWorkspaceRpcTarget.test.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { describe, expect, it } from "vitest";
  2. import { resolveAppWorkspaceRpcTarget } from "@/app-shell/workspaceRpcTarget.js";
  3. describe("resolveAppWorkspaceRpcTarget", () => {
  4. it("falls back to the explicit remote workspace identity when active tab has no workspace metadata", () => {
  5. const workspaceIdentity =
  6. "remote:ssh:124.223.19.106:22:ubuntu:/home/ubuntu/workspace";
  7. expect(
  8. resolveAppWorkspaceRpcTarget({
  9. activeTarget: {
  10. workspaceIdentity: undefined,
  11. remoteSessionId: undefined,
  12. remoteTarget: undefined,
  13. },
  14. explicitWorkspaceIdentity: workspaceIdentity,
  15. explicitRemoteSessionId: undefined,
  16. }),
  17. ).toEqual({
  18. workspaceIdentity,
  19. remoteSessionId: undefined,
  20. remoteTarget: undefined,
  21. });
  22. });
  23. it("does not add remote identity or session for a local workspace", () => {
  24. expect(
  25. resolveAppWorkspaceRpcTarget({
  26. activeTarget: {
  27. workspaceIdentity: undefined,
  28. remoteSessionId: undefined,
  29. remoteTarget: undefined,
  30. },
  31. explicitWorkspaceIdentity: undefined,
  32. explicitRemoteSessionId: undefined,
  33. }),
  34. ).toEqual({
  35. workspaceIdentity: undefined,
  36. remoteSessionId: undefined,
  37. remoteTarget: undefined,
  38. });
  39. });
  40. });