ci(release): handle no folder gracefully (#27)

This commit is contained in:
Sebastian Poxhofer 2025-03-01 01:20:00 +01:00 committed by GitHub
parent 66adc32ff7
commit bf4743acac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View file

@ -57,6 +57,12 @@ describe("push-charts", () => {
});
describe("getChangedCharts", () => {
test("should return empty if archive folder does not exist", async () => {
fs.access.mockRejectedValue(new Error("not found"));
child_process.execSync.mockReturnValue(Buffer.from(""));
await expect(getChangedChartsArchives(["my-chart"])).resolves.toEqual([]);
});
test("should return changed chart if only one exists", async () => {
fs.readdir.mockResolvedValue([myChartDirentMock]);
child_process.execSync.mockReturnValue(Buffer.from(""));