Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(skills): update an example
Elian Doran8c6649d1dbd0
diff --git a/.claude/skills/writing-unit-tests/server-and-core.md b/.claude/skills/writing-unit-tests/server-and-core.mdindex 133d17c0c1..8bce87ea99 100644--- a/.claude/skills/writing-unit-tests/server-and-core.md+++ b/.claude/skills/writing-unit-tests/server-and-core.md@@ -42,7 +42,7 @@ describe("X API (core)", () => {Both test setups (`apps/server/spec/setup.ts`, `apps/standalone/src/test_setup.ts`) inject the **real platform providers** (zip = archiver/fflate, image = sharp/magic-bytes, backup = fs/OPFS), and **both vitest suites run on Node** (the standalone setup itself imports `node:fs`/`node:module`) — so `Buffer`, `node:stream`, `node:fs` are available in either runtime. The tester's mock `res` is a real Node `Writable` that also implements the Express surface (`set`/`setHeader`/`removeHeader`/`status`/`send`/`sendStatus`/`write`/`end`), so the **server** export path (`archiver.pipe(res)`, needs a real writable) and the **browser** path (`BrowserZipArchive.finalize()` → `res.send(bytes)`) both run. Match the ETAPI **zero-mock** convention: drive real inputs and assert real output.- **Multipart**: pass `file: { originalname, mimetype, buffer: Buffer.from(...) }` — the real import/image handlers run.- **Binary/streamed response bodies** come back as a `Buffer` (real zips start with `PK`); text as a string; JSON as an object.-- **Need a real zip cross-runtime?** Export→import round-trip: `const zip = await api.get(\`/api/branches/${"<branchId>"}/export/subtree/html/1.0/t\`)` gives a real zip `Buffer` in `zip.body`; feed it back to `.../notes-import` as the `file.buffer`.+- **Need a real zip cross-runtime?** Export→import round-trip: `const zip = await api.get(\`/api/branches/${"<branchId>"}/export/subtree/html/t\`)` gives a real zip `Buffer` in `zip.body`; feed it back to `.../notes-import` as the `file.buffer`.### When a core route still needs a *targeted* mock (the genuine exceptions)Only where the platform op can't run against the ephemeral test env — keep it minimal and documented, and prefer `vi.spyOn(importedServiceObject, "method")` over `vi.mock`: