Skip to content

Commit 79b6f7c

Browse files
committed
fix(ssh): use path.join in test assertions for cross-platform path compatibility
1 parent c4f36b7 commit 79b6f7c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

test/ssh/sshHelpers.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2+
import path from 'path';
23
import {
34
validateAgentSocketPath,
45
convertToSSHUrl,
@@ -130,7 +131,7 @@ describe('sshHelpers', () => {
130131

131132
const knownHostsPath = await createKnownHostsFile(tempDir, sshUrl);
132133

133-
expect(knownHostsPath).toBe('/tmp/test-dir/known_hosts');
134+
expect(knownHostsPath).toBe(path.join(tempDir, 'known_hosts'));
134135
expect(childProcessStub.execSync).toHaveBeenCalledWith(
135136
'ssh-keyscan -t ed25519 github.com 2>/dev/null',
136137
expect.objectContaining({
@@ -139,7 +140,7 @@ describe('sshHelpers', () => {
139140
}),
140141
);
141142
expect(fsStub.promises.writeFile).toHaveBeenCalledWith(
142-
'/tmp/test-dir/known_hosts',
143+
path.join(tempDir, 'known_hosts'),
143144
expect.stringContaining('github.com ssh-ed25519'),
144145
{ mode: 0o600 },
145146
);
@@ -155,7 +156,7 @@ describe('sshHelpers', () => {
155156

156157
const knownHostsPath = await createKnownHostsFile(tempDir, sshUrl);
157158

158-
expect(knownHostsPath).toBe('/tmp/test-dir/known_hosts');
159+
expect(knownHostsPath).toBe(path.join(tempDir, 'known_hosts'));
159160
expect(childProcessStub.execSync).toHaveBeenCalledWith(
160161
'ssh-keyscan -t ed25519 gitlab.com 2>/dev/null',
161162
expect.anything(),

0 commit comments

Comments
 (0)