test(firmware): stat raw links without following them

access follows a symlink, so a published dangling raw-link still looked
absent. lstat and readlink inspect the link itself.
This commit is contained in:
Cursor Agent committed 2026-10-29 09:04:38 +00:00
1 parent 499adf993b
commit 1709267cc6
1 file changed
+12 -2
@@ -1,5 +1,13 @@
import { createHash } from "node:crypto";
import { access, mkdir, readFile, symlink, writeFile } from "node:fs/promises";
import {
access,
lstat,
mkdir,
readFile,
readlink,
symlink,
writeFile,
} from "node:fs/promises";
import { join } from "node:path";
import { expect, it, vi } from "vitest";
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
@@ -227,7 +235,9 @@ it("publishes the writer's normalized path while retaining source spelling and u
link_target_hex: "73616d706c65efbfbd",
},
]);
await expect(access(join(output, "raw-link"))).rejects.toMatchObject({
const rawLink = join(output, "raw-link");
await expect(lstat(rawLink)).rejects.toMatchObject({ code: "ENOENT" });
await expect(readlink(rawLink)).rejects.toMatchObject({
code: "ENOENT",
});
await validateAdvertisedFirmwareOutput(result);