Fix web test failures

- Update notification preferences test to expect enabled: false as default (matching macOS defaults)
- Add PtyManager.initialize() calls to integration tests to fix initialization errors
- Make createTestServer async to properly initialize PtyManager
- Fix formatting issues in test files

This fixes the failing tests in config-service.test.ts, worktree-workflows.test.ts,
and socket-protocol-integration.test.ts.
This commit is contained in:
Peter Steinberger 2025-07-27 16:41:01 +02:00
parent 22bcdeffd4
commit f87b511ec1
4 changed files with 11 additions and 4 deletions

View file

@ -425,7 +425,7 @@ describe('ConfigService', () => {
const preferences = configService.getNotificationPreferences();
// Should return DEFAULT_NOTIFICATION_PREFERENCES instead of undefined
expect(preferences).toEqual({
enabled: true,
enabled: false, // Master switch is OFF by default
sessionStart: true,
sessionExit: true,
commandCompletion: true,

View file

@ -39,7 +39,7 @@ export interface TestServerResult {
/**
* Create a test server with properly initialized services
*/
export function createTestServer(options: TestServerOptions = {}): TestServerResult {
export async function createTestServer(options: TestServerOptions = {}): Promise<TestServerResult> {
const {
controlPath,
isHQMode = false,
@ -51,6 +51,9 @@ export function createTestServer(options: TestServerOptions = {}): TestServerRes
},
} = options;
// Initialize PtyManager before creating instance
await PtyManager.initialize();
// Initialize services
const ptyManager = new PtyManager(controlPath);
const terminalManager = new TerminalManager();

View file

@ -23,7 +23,7 @@ describe('Socket Protocol Integration', () => {
let ptyManager: PtyManager;
let sessionHelper: SessionTestHelper;
beforeEach(() => {
beforeEach(async () => {
// IMPORTANT: macOS has a 104 character limit for Unix socket paths (103 usable).
// The full socket path will be: testDir + sessionId (36 chars UUID) + '/ipc.sock' (9 chars)
// Example: /tmp/vt-1234567890/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/ipc.sock
@ -31,6 +31,10 @@ describe('Socket Protocol Integration', () => {
// Using /tmp/vt-timestamp keeps us well under the limit.
testDir = `/tmp/vt-${Date.now()}`;
fs.mkdirSync(testDir, { recursive: true });
// Initialize PtyManager before creating instance
await PtyManager.initialize();
ptyManager = new PtyManager(testDir);
sessionHelper = new SessionTestHelper(ptyManager);
});

View file

@ -17,7 +17,7 @@ describe('Worktree Workflows Integration Tests', () => {
gitRepo = await createStandardTestRepo();
// Create test server with all services properly initialized
testServer = createTestServer({
testServer = await createTestServer({
includeRoutes: {
sessions: true,
worktrees: true,