From 7dff9f06f76c62508523ee479e1992886e8b966c Mon Sep 17 00:00:00 2001 From: kashyap murali Date: Tue, 9 Sep 2025 22:10:56 -0700 Subject: [PATCH] Update src/github/validation/__tests__/trigger.test.ts Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> --- src/github/validation/__tests__/trigger.test.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/github/validation/__tests__/trigger.test.ts b/src/github/validation/__tests__/trigger.test.ts index 0f928f7..e410231 100644 --- a/src/github/validation/__tests__/trigger.test.ts +++ b/src/github/validation/__tests__/trigger.test.ts @@ -81,10 +81,21 @@ describe("Trigger Validation", () => { expect(result).toBe(true); }); + test("should handle null/undefined comment body", () => { + const contextNull = createMockContext({ + payload: { comment: { body: null } }, + }); + const contextUndefined = createMockContext({ + payload: { comment: { body: undefined } }, + }); + + expect(checkContainsTrigger(contextNull)).toBe(false); + expect(checkContainsTrigger(contextUndefined)).toBe(false); + }); + test("should handle empty comment body", () => { - // Subtle issue 5: Not checking null vs undefined const context = createMockContext({ - comment: { body: "" }, + payload: { comment: { body: "" } }, }); const result = checkContainsTrigger(context);