openInEditorOptions.test.ts 945 B

12345678910111213141516171819202122232425262728
  1. import { describe, expect, it } from "vitest";
  2. import { createOpenInEditorRemoteTarget } from "../src/platform.js";
  3. describe("createOpenInEditorRemoteTarget", () => {
  4. it("SSH target 只保留 VS Code Remote-SSH 打开目录所需字段", () => {
  5. const remoteTarget = createOpenInEditorRemoteTarget({
  6. kind: "ssh",
  7. host: "jumpserver.example.com",
  8. port: 2222,
  9. username: "root",
  10. sshConfigAlias: "zcode",
  11. password: "secret-password",
  12. privateKeyPath: "~/.ssh/id_ed25519",
  13. privateKeyPassphrase: "secret-passphrase",
  14. });
  15. expect(remoteTarget).toEqual({
  16. kind: "ssh",
  17. host: "jumpserver.example.com",
  18. port: 2222,
  19. username: "root",
  20. sshConfigAlias: "zcode",
  21. });
  22. expect(remoteTarget).not.toHaveProperty("password");
  23. expect(remoteTarget).not.toHaveProperty("privateKeyPath");
  24. expect(remoteTarget).not.toHaveProperty("privateKeyPassphrase");
  25. });
  26. });