fix: auto gmail serve path for tailscale

This commit is contained in:
Peter Steinberger
2025-12-24 21:56:17 +00:00
parent 79870472e1
commit cffac6e11a
3 changed files with 75 additions and 6 deletions

View File

@@ -60,4 +60,49 @@ describe("gmail hook config", () => {
);
expect(result.ok).toBe(false);
});
it("defaults serve path to / when tailscale is enabled", () => {
const result = resolveGmailHookRuntimeConfig(
{
hooks: {
token: "hook-token",
gmail: {
account: "clawdbot@gmail.com",
topic: "projects/demo/topics/gog-gmail-watch",
pushToken: "push-token",
tailscale: { mode: "funnel" },
},
},
},
{},
);
expect(result.ok).toBe(true);
if (result.ok) {
expect(result.value.serve.path).toBe("/");
expect(result.value.tailscale.path).toBe("/gmail-pubsub");
}
});
it("keeps explicit serve path for tailscale when set", () => {
const result = resolveGmailHookRuntimeConfig(
{
hooks: {
token: "hook-token",
gmail: {
account: "clawdbot@gmail.com",
topic: "projects/demo/topics/gog-gmail-watch",
pushToken: "push-token",
serve: { path: "/custom" },
tailscale: { mode: "funnel" },
},
},
},
{},
);
expect(result.ok).toBe(true);
if (result.ok) {
expect(result.value.serve.path).toBe("/custom");
expect(result.value.tailscale.path).toBe("/custom");
}
});
});