* Build a minimal `.tar.gz` for a tiny planDir containing `plan.json` + * `meta/chunks.json`. Used by renderChunk/assemble tests where the handler * untars but the mock primitive doesn't inspect contents.
()
| 552 | * untars but the mock primitive doesn't inspect contents. |
| 553 | */ |
| 554 | async function makeMinimalPlanTar(): Promise<Buffer> { |
| 555 | const tar = await import("tar"); |
| 556 | const { |
| 557 | mkdtempSync: mk, |
| 558 | mkdirSync: md, |
| 559 | readFileSync: rf, |
| 560 | writeFileSync: wf, |
| 561 | } = await import("node:fs"); |
| 562 | const dir = mk(join(tmpdir(), "hf-lambda-test-plan-")); |
| 563 | tmpDirs.push(dir); |
| 564 | md(join(dir, "meta"), { recursive: true }); |
| 565 | wf(join(dir, "plan.json"), JSON.stringify({ planHash: "fakehash" })); |
| 566 | wf(join(dir, "meta", "chunks.json"), "[]"); |
| 567 | const tarPath = join(dir, "out.tar.gz"); |
| 568 | await tar.create({ gzip: true, file: tarPath, cwd: dir }, ["plan.json", "meta"]); |
| 569 | return rf(tarPath); |
| 570 | } |