From 17dae1571b0154abcb8addf853bb0e7fbce9d442 Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 1 Jan 2026 18:07:00 +0100 Subject: [PATCH] fix(tests): update terminal-service tests to work cross-platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated terminal-service.test.ts to use path.resolve() in test expectations so they work correctly on both Unix and Windows platforms. The merge from main removed the skipIf conditions for Windows, expecting these tests to work cross-platform. On Windows, path.resolve('/test/dir') converts Unix-style paths to Windows paths (e.g., 'P:\test\dir'), so test expectations needed to use path.resolve() as well to match the actual behavior. Fixed tests: - should create a new terminal session - should fix double slashes in path - should return all active sessions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .../tests/unit/services/terminal-service.test.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/server/tests/unit/services/terminal-service.test.ts b/apps/server/tests/unit/services/terminal-service.test.ts index 88660f7f..d9258433 100644 --- a/apps/server/tests/unit/services/terminal-service.test.ts +++ b/apps/server/tests/unit/services/terminal-service.test.ts @@ -2,6 +2,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { TerminalService, getTerminalService } from '@/services/terminal-service.js'; import * as pty from 'node-pty'; import * as os from 'os'; +import * as path from 'path'; import * as platform from '@automaker/platform'; import * as secureFs from '@/lib/secure-fs.js'; @@ -288,13 +289,13 @@ describe('terminal-service.ts', () => { expect(session).not.toBeNull(); expect(session!.id).toMatch(/^term-/); - expect(session!.cwd).toBe('/test/dir'); + expect(session!.cwd).toBe(path.resolve('/test/dir')); expect(session!.shell).toBe('/bin/bash'); expect(pty.spawn).toHaveBeenCalledWith( '/bin/bash', ['--login'], expect.objectContaining({ - cwd: '/test/dir', + cwd: path.resolve('/test/dir'), cols: 100, rows: 30, }) @@ -354,7 +355,7 @@ describe('terminal-service.ts', () => { }); expect(session).not.toBeNull(); - expect(session!.cwd).toBe('/test/dir'); + expect(session!.cwd).toBe(path.resolve('/test/dir')); }); it('should preserve WSL UNC paths', async () => { @@ -568,8 +569,8 @@ describe('terminal-service.ts', () => { expect(session2).not.toBeNull(); expect(sessions[0].id).toBe(session1!.id); expect(sessions[1].id).toBe(session2!.id); - expect(sessions[0].cwd).toBe('/dir1'); - expect(sessions[1].cwd).toBe('/dir2'); + expect(sessions[0].cwd).toBe(path.resolve('/dir1')); + expect(sessions[1].cwd).toBe(path.resolve('/dir2')); }); it('should return empty array if no sessions', () => {