Skip to content

Commit 22e211d

Browse files
committed
test: cover EPERM locked snapshot stats
(cherry picked from commit 3d58661)
1 parent 36c25dd commit 22e211d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/account-snapshot.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ describe("statSnapshot", () => {
4444
);
4545
});
4646

47+
it("treats locked snapshots as existing when stat returns EPERM", async () => {
48+
const logWarn = vi.fn();
49+
await expect(
50+
statSnapshot("locked.json", {
51+
stat: vi.fn(async () => {
52+
throw Object.assign(new Error("perm"), { code: "EPERM" });
53+
}),
54+
logWarn,
55+
}),
56+
).resolves.toEqual({ exists: true });
57+
expect(logWarn).toHaveBeenCalledWith(
58+
"Backup candidate is locked",
59+
expect.objectContaining({ path: "locked.json" }),
60+
);
61+
});
62+
4763
});
4864

4965
describe("describeAccountSnapshot", () => {

0 commit comments

Comments
 (0)