diff --git a/src/hooks/gmail.test.ts b/src/hooks/gmail.test.ts index 7969ccb15c4a..c39f6476e717 100644 --- a/src/hooks/gmail.test.ts +++ b/src/hooks/gmail.test.ts @@ -6,6 +6,8 @@ import { buildGogWatchPullLogArgs, buildGogWatchServeLogArgs, buildTopicPath, + isGmailHookPullRuntimeConfig, + isGmailHookPushRuntimeConfig, parseSubscriptionPath, parseTopicPath, resolveGmailHookRuntimeConfig, @@ -51,7 +53,7 @@ describe("gmail hook config", () => { return; } expect(result.value.delivery.mode).toBe("push"); - if (result.value.delivery.mode !== "push") { + if (!isGmailHookPushRuntimeConfig(result.value)) { return; } expect(result.value.serve.path).toBe(expected.servePath); @@ -91,7 +93,7 @@ describe("gmail hook config", () => { expect(result.value.delivery.mode).toBe("push"); expect(result.value.label).toBe("INBOX"); expect(result.value.includeBody).toBe(true); - if (result.value.delivery.mode !== "push") { + if (!isGmailHookPushRuntimeConfig(result.value)) { return; } expect(result.value.serve.port).toBe(8788); @@ -159,7 +161,7 @@ describe("gmail hook config", () => { return; } expect(result.value.delivery.mode).toBe("push"); - if (result.value.delivery.mode !== "push") { + if (!isGmailHookPushRuntimeConfig(result.value)) { return; } @@ -209,7 +211,7 @@ describe("gmail hook config", () => { return; } expect(result.value.delivery.mode).toBe("pull"); - if (result.value.delivery.mode !== "pull") { + if (!isGmailHookPullRuntimeConfig(result.value)) { return; } diff --git a/src/hooks/gmail.ts b/src/hooks/gmail.ts index 51bd438ec245..b17cf19921a0 100644 --- a/src/hooks/gmail.ts +++ b/src/hooks/gmail.ts @@ -356,9 +356,9 @@ export function buildGogWatchPullHelpArgs(): string[] { function removeGogWatchSensitiveArgs(args: string[]): string[] { return args.filter( - (arg, index, args) => + (arg, index, allArgs) => !GMAIL_WATCH_SENSITIVE_FLAGS.has(arg) && - !GMAIL_WATCH_SENSITIVE_FLAGS.has(args[index - 1] ?? ""), + !GMAIL_WATCH_SENSITIVE_FLAGS.has(allArgs[index - 1] ?? ""), ); }