Skip to content

Commit

Permalink
test(helm): invalid local path
Browse files Browse the repository at this point in the history
  • Loading branch information
yz89122 committed Jun 21, 2024
1 parent b69996e commit 4feaf84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Binary file added packages/helm/src/__fixtures__/tar/bad-tar.tgz
Binary file not shown.
15 changes: 13 additions & 2 deletions packages/helm/src/__tests__/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jest.mock("@kosko/exec-utils", () => {

const FIXTURE_DIR = join(__dirname, "../__fixtures__");
const NGINX_CHART = join(FIXTURE_DIR, "nginx");
const TAR_CHART = join(FIXTURE_DIR, "tar", "prometheus-25.22.0.tgz");

const mockedSpawn = jest.mocked(spawn);

Expand All @@ -33,11 +32,23 @@ test("chart is a local path", async () => {
await expect(result()).resolves.toMatchSnapshot();
});

test("invalid local chart path", async () => {
const result = loadChart({ chart: FIXTURE_DIR });
await expect(result()).rejects.toThrow();
});

test("chart is a local tarball", async () => {
const result = loadChart({ chart: TAR_CHART });
const result = loadChart({
chart: join(FIXTURE_DIR, "tar", "prometheus-25.22.0.tgz")
});
await expect(result()).resolves.toMatchSnapshot();
});

test("invalid local tarball", async () => {
const result = loadChart({ chart: join(FIXTURE_DIR, "tar", "bad-tar.tgz") });
await expect(result()).rejects.toThrow();
});

test("chart is remote", async () => {
const result = loadChart({
chart: "prometheus",
Expand Down

0 comments on commit 4feaf84

Please sign in to comment.