mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-26 04:25:27 +02:00
Tests: normalize path expectations for cross-platform CI
This commit is contained in:
@@ -13,6 +13,10 @@ function encodeMountInfoPath(value: string): string {
|
||||
.replace(/ /g, "\\040");
|
||||
}
|
||||
|
||||
function resolved(value: string): string {
|
||||
return path.resolve(value);
|
||||
}
|
||||
|
||||
describe("detectLinuxSdBackedStateDir", () => {
|
||||
it("detects state dir on mmc-backed mount", () => {
|
||||
const mountInfo = [
|
||||
@@ -26,8 +30,8 @@ describe("detectLinuxSdBackedStateDir", () => {
|
||||
});
|
||||
|
||||
expect(result).toEqual({
|
||||
path: "/home/pi/.openclaw",
|
||||
mountPoint: "/",
|
||||
path: resolved("/home/pi/.openclaw"),
|
||||
mountPoint: resolved("/"),
|
||||
fsType: "ext4",
|
||||
source: "/dev/mmcblk0p2",
|
||||
});
|
||||
@@ -59,8 +63,8 @@ describe("detectLinuxSdBackedStateDir", () => {
|
||||
});
|
||||
|
||||
expect(result).toEqual({
|
||||
path: "/home/user/.openclaw",
|
||||
mountPoint: "/",
|
||||
path: resolved("/home/user/.openclaw"),
|
||||
mountPoint: resolved("/"),
|
||||
fsType: "ext4",
|
||||
source: "/dev/disk/by-uuid/abcd-1234",
|
||||
});
|
||||
@@ -79,8 +83,8 @@ describe("detectLinuxSdBackedStateDir", () => {
|
||||
});
|
||||
|
||||
expect(result).toEqual({
|
||||
path: "/mnt/slow/openclaw/.openclaw",
|
||||
mountPoint: "/mnt/slow",
|
||||
path: resolved("/mnt/slow/openclaw/.openclaw"),
|
||||
mountPoint: resolved("/mnt/slow"),
|
||||
fsType: "ext4",
|
||||
source: "/dev/mmcblk1p1",
|
||||
});
|
||||
@@ -118,7 +122,7 @@ describe("detectLinuxSdBackedStateDir", () => {
|
||||
expect(result).not.toBeNull();
|
||||
const warning = formatLinuxSdBackedStateDirWarning(stateDir, result!);
|
||||
expect(warning).toContain("device /dev/disk/by-uuid/mmc\\nsource");
|
||||
expect(warning).toContain("mount /home/pi/mnt\\nspoofed");
|
||||
expect(warning).toContain(`mount ${resolved("/home/pi/mnt\nspoofed").replace(/\n/g, "\\n")}`);
|
||||
expect(warning).not.toContain("device /dev/disk/by-uuid/mmc\nsource");
|
||||
expect(warning).not.toContain("mount /home/pi/mnt\nspoofed");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user