mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 09:17:38 +00:00
Update: harden control UI asset handling in update flow (#10146)
* Update: harden control UI asset handling in update flow * fix: harden update doctor entrypoint guard (#10146) (thanks @gumadeiras)
This commit is contained in:
committed by
GitHub
parent
50e687d17d
commit
c75275f109
@@ -3,7 +3,9 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
resolveControlUiDistIndexHealth,
|
||||
resolveControlUiDistIndexPath,
|
||||
resolveControlUiDistIndexPathForRoot,
|
||||
resolveControlUiRepoRoot,
|
||||
resolveControlUiRootOverrideSync,
|
||||
resolveControlUiRootSync,
|
||||
@@ -190,4 +192,33 @@ describe("control UI assets helpers", () => {
|
||||
await fs.rm(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("reports health for existing control-ui assets at a known root", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-ui-"));
|
||||
try {
|
||||
const indexPath = resolveControlUiDistIndexPathForRoot(tmp);
|
||||
await fs.mkdir(path.dirname(indexPath), { recursive: true });
|
||||
await fs.writeFile(indexPath, "<html></html>\n");
|
||||
|
||||
await expect(resolveControlUiDistIndexHealth({ root: tmp })).resolves.toEqual({
|
||||
indexPath,
|
||||
exists: true,
|
||||
});
|
||||
} finally {
|
||||
await fs.rm(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("reports health for missing control-ui assets at a known root", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-ui-"));
|
||||
try {
|
||||
const indexPath = resolveControlUiDistIndexPathForRoot(tmp);
|
||||
await expect(resolveControlUiDistIndexHealth({ root: tmp })).resolves.toEqual({
|
||||
indexPath,
|
||||
exists: false,
|
||||
});
|
||||
} finally {
|
||||
await fs.rm(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user