fix(hooks): satisfy gmail delivery type checks

This commit is contained in:
joshp123
2026-06-05 21:32:12 +02:00
parent e0b702400d
commit 89fcda4a64
2 changed files with 8 additions and 6 deletions

View File

@@ -6,6 +6,8 @@ import {
buildGogWatchPullLogArgs, buildGogWatchPullLogArgs,
buildGogWatchServeLogArgs, buildGogWatchServeLogArgs,
buildTopicPath, buildTopicPath,
isGmailHookPullRuntimeConfig,
isGmailHookPushRuntimeConfig,
parseSubscriptionPath, parseSubscriptionPath,
parseTopicPath, parseTopicPath,
resolveGmailHookRuntimeConfig, resolveGmailHookRuntimeConfig,
@@ -51,7 +53,7 @@ describe("gmail hook config", () => {
return; return;
} }
expect(result.value.delivery.mode).toBe("push"); expect(result.value.delivery.mode).toBe("push");
if (result.value.delivery.mode !== "push") { if (!isGmailHookPushRuntimeConfig(result.value)) {
return; return;
} }
expect(result.value.serve.path).toBe(expected.servePath); 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.delivery.mode).toBe("push");
expect(result.value.label).toBe("INBOX"); expect(result.value.label).toBe("INBOX");
expect(result.value.includeBody).toBe(true); expect(result.value.includeBody).toBe(true);
if (result.value.delivery.mode !== "push") { if (!isGmailHookPushRuntimeConfig(result.value)) {
return; return;
} }
expect(result.value.serve.port).toBe(8788); expect(result.value.serve.port).toBe(8788);
@@ -159,7 +161,7 @@ describe("gmail hook config", () => {
return; return;
} }
expect(result.value.delivery.mode).toBe("push"); expect(result.value.delivery.mode).toBe("push");
if (result.value.delivery.mode !== "push") { if (!isGmailHookPushRuntimeConfig(result.value)) {
return; return;
} }
@@ -209,7 +211,7 @@ describe("gmail hook config", () => {
return; return;
} }
expect(result.value.delivery.mode).toBe("pull"); expect(result.value.delivery.mode).toBe("pull");
if (result.value.delivery.mode !== "pull") { if (!isGmailHookPullRuntimeConfig(result.value)) {
return; return;
} }

View File

@@ -356,9 +356,9 @@ export function buildGogWatchPullHelpArgs(): string[] {
function removeGogWatchSensitiveArgs(args: string[]): string[] { function removeGogWatchSensitiveArgs(args: string[]): string[] {
return args.filter( return args.filter(
(arg, index, args) => (arg, index, allArgs) =>
!GMAIL_WATCH_SENSITIVE_FLAGS.has(arg) && !GMAIL_WATCH_SENSITIVE_FLAGS.has(arg) &&
!GMAIL_WATCH_SENSITIVE_FLAGS.has(args[index - 1] ?? ""), !GMAIL_WATCH_SENSITIVE_FLAGS.has(allArgs[index - 1] ?? ""),
); );
} }