mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
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:
@@ -81,10 +81,21 @@ describe("Trigger Validation", () => {
|
|||||||
expect(result).toBe(true);
|
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", () => {
|
test("should handle empty comment body", () => {
|
||||||
// Subtle issue 5: Not checking null vs undefined
|
|
||||||
const context = createMockContext({
|
const context = createMockContext({
|
||||||
comment: { body: "" },
|
payload: { comment: { body: "" } },
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = checkContainsTrigger(context);
|
const result = checkContainsTrigger(context);
|
||||||
|
|||||||
Reference in New Issue
Block a user