test(daemon): read launchd fixture files

This commit is contained in:
Peter Steinberger
2026-04-25 07:11:29 +01:00
parent 2a96ea4d72
commit 33d5ebbff7

View File

@@ -249,6 +249,14 @@ vi.mock("node:fs/promises", async () => {
unlink: vi.fn(async (p: string) => {
state.files.delete(p);
}),
readFile: vi.fn(async (p: string) => {
const key = p;
const data = state.files.get(key);
if (data !== undefined) {
return data;
}
throw new Error(`ENOENT: no such file or directory, read '${key}'`);
}),
writeFile: vi.fn(async (p: string, data: string, opts?: { mode?: number }) => {
const key = p;
state.files.set(key, data);
@@ -490,7 +498,6 @@ describe("launchd install", () => {
const plistPath = resolveLaunchAgentPlistPath(env);
state.serviceLoaded = false;
state.kickstartError = "Could not find service";
state.kickstartCode = 113;
state.kickstartFailuresRemaining = 1;
state.files.set(
plistPath,