star-chart-search-enhancer/tests/package-release-archive.test.ts
admin123 66e814b30f
All checks were successful
continuous-integration/drone/tag Build is passing
fix: package release zip without system binary
2026-05-25 11:57:22 +08:00

26 lines
896 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 without relying on the system zip binary", 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);
});
});