test: add test for valid jar artifacts

This commit is contained in:
William Will 2023-03-30 02:46:44 -06:00
parent 58bb403787
commit e527f043b0

26
test/bin/jar.spec.ts Normal file
View File

@ -0,0 +1,26 @@
import jar from "keycloakify/bin/tools/jar";
import { it, describe, vi } from "vitest";
vi.mock("fs", () => ({ promises: { mkdir: () => {} }, createWriteStream: () => {} }));
vi.mock("stream", async () => {
const readableMock = () => {
const mockDecorators = {
on: () => mockDecorators,
pipe: () => mockDecorators
};
return {
from: () => mockDecorators
};
};
return {
// @ts-ignore
...(await vi.importActual("stream")),
Readable: readableMock()
};
});
describe("jar", () => {
it("creates jar artifacts without error", () => {
jar({ artifactId: "artifactId", groupId: "groupId", rootPath: "rootPath", targetPath: "targetPath", version: "1.0.0" });
});
});