From 8c3d810a544901ac4aa74374e8106cb53488ea20 Mon Sep 17 00:00:00 2001 From: sudacode Date: Sat, 7 Mar 2026 01:50:31 -0800 Subject: [PATCH] fix(test): seed launcher smoke setup state --- launcher/smoke.e2e.test.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/launcher/smoke.e2e.test.ts b/launcher/smoke.e2e.test.ts index 72ba9f14..b68cbcca 100644 --- a/launcher/smoke.e2e.test.ts +++ b/launcher/smoke.e2e.test.ts @@ -4,6 +4,13 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { spawn, spawnSync } from 'node:child_process'; +import { + createDefaultSetupState, + getDefaultConfigDir, + getSetupStatePath, + readSetupState, + writeSetupState, +} from '../src/shared/setup-state.js'; type RunResult = { status: number | null; @@ -58,6 +65,13 @@ function createSmokeCase(name: string): SmokeCase { `socket_path=${socketPath}\n`, ); + const configDir = getDefaultConfigDir({ xdgConfigHome, homeDir }); + const setupState = createDefaultSetupState(); + setupState.status = 'completed'; + setupState.completedAt = '2026-03-07T00:00:00.000Z'; + setupState.completionSource = 'user'; + writeSetupState(getSetupStatePath(configDir), setupState); + const fakeMpvLogPath = path.join(artifactsDir, 'fake-mpv.log'); const fakeAppLogPath = path.join(artifactsDir, 'fake-app.log'); const fakeAppStartLogPath = path.join(artifactsDir, 'fake-app-start.log'); @@ -224,6 +238,22 @@ async function waitForJsonLines( } } +test('launcher smoke fixture seeds completed setup state', () => { + const smokeCase = createSmokeCase('setup-state'); + try { + const configDir = getDefaultConfigDir({ + xdgConfigHome: smokeCase.xdgConfigHome, + homeDir: smokeCase.homeDir, + }); + const statePath = getSetupStatePath(configDir); + + assert.equal(readSetupState(statePath)?.status, 'completed'); + } finally { + fs.rmSync(smokeCase.root, { recursive: true, force: true }); + fs.rmSync(smokeCase.socketDir, { recursive: true, force: true }); + } +}); + test('launcher mpv status returns ready when socket is connectable', async () => { await withSmokeCase('mpv-status', async (smokeCase) => { const env = makeTestEnv(smokeCase);