star-chart-search-enhancer/tests/package-release-archive.test.ts
admin123 f683b1db4f
All checks were successful
continuous-integration/drone/tag Build is passing
fix: keep release archive wrapped in a folder
2026-05-25 14:22:59 +08:00

29 lines
996 B
TypeScript

import { mkdtemp, mkdir, readFile, writeFile } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, test } from "vitest";
import { createReleaseArchive } from "../scripts/package-release-archive.mjs";
describe("package-release-archive", () => {
test("creates a zip archive with a top-level release folder", async () => {
const tempDir = await mkdtemp(path.join(os.tmpdir(), "release-archive-"));
const sourceDir = path.join(tempDir, "source");
const archivePath = path.join(tempDir, "archive.zip");
await mkdir(sourceDir, { recursive: true });
await writeFile(path.join(sourceDir, "hello.txt"), "hello world", "utf8");
await createReleaseArchive({
archivePath,
sourceDir
});
const archive = await readFile(archivePath);
expect(archive.byteLength).toBeGreaterThan(0);
expect(archive.toString("utf8")).toContain(
"star-chart-search-enhancer-internal/hello.txt"
);
});
});