Update src/github/validation/__tests__/trigger.test.ts

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
This commit is contained in:
kashyap murali
2025-09-09 22:10:56 -07:00
committed by GitHub
parent f6b1490a80
commit 7dff9f06f7

View File

@@ -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);