Skip to content

Commit 7902b75

Browse files
committed
fix type check
1 parent df74f90 commit 7902b75

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

dify-helm-watchdog/src/test/api/v1/cron.test.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ describe("POST /api/v1/cron", () => {
149149

150150
it("should stream sync progress logs", async () => {
151151
const mockLogs: string[] = [];
152-
mockedSyncHelmData.mockImplementation(async ({ log }) => {
152+
mockedSyncHelmData.mockImplementation(async (options) => {
153+
const log = options?.log || (() => {});
153154
log("Fetching chart index...");
154155
mockLogs.push("Fetching chart index...");
155156
log("Processing version 2.5.0...");
@@ -191,7 +192,9 @@ describe("POST /api/v1/cron", () => {
191192
let capturedOptions: { forceVersions?: string[] } = {};
192193

193194
mockedSyncHelmData.mockImplementation(async (options) => {
194-
capturedOptions = options;
195+
if (options) {
196+
capturedOptions = options;
197+
}
195198
return {
196199
processed: 2,
197200
created: 0,
@@ -253,7 +256,7 @@ describe("POST /api/v1/cron", () => {
253256

254257
it("should handle MissingBlobTokenError gracefully", async () => {
255258
mockedSyncHelmData.mockRejectedValueOnce(
256-
new MissingBlobTokenError("Blob storage token is not configured"),
259+
new MissingBlobTokenError(),
257260
);
258261

259262
const request = new Request("http://localhost/api/v1/cron", {
@@ -446,7 +449,9 @@ describe("POST /api/v1/cron", () => {
446449
let capturedOptions: { forceVersions?: string[] } = {};
447450

448451
mockedSyncHelmData.mockImplementation(async (options) => {
449-
capturedOptions = options;
452+
if (options) {
453+
capturedOptions = options;
454+
}
450455
return {
451456
processed: 1,
452457
created: 0,
@@ -474,7 +479,9 @@ describe("POST /api/v1/cron", () => {
474479
let capturedOptions: { forceVersions?: string[] } = {};
475480

476481
mockedSyncHelmData.mockImplementation(async (options) => {
477-
capturedOptions = options;
482+
if (options) {
483+
capturedOptions = options;
484+
}
478485
return {
479486
processed: 2,
480487
created: 0,

0 commit comments

Comments
 (0)