diff --git a/test/bin/jar.spec.ts b/test/bin/jar.spec.ts new file mode 100644 index 00000000..7f19b3d3 --- /dev/null +++ b/test/bin/jar.spec.ts @@ -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" }); + }); +});