Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/coding-agent/__tests__/onMergeTestToMainAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ function createMockBot() {
}

describe("registerOnMergeTestToMainAction", () => {
it("registers merge_test_to_main: action handler", () => {
it("registers catch-all action handler", () => {
const bot = createMockBot();
registerOnMergeTestToMainAction(bot);
expect(bot.onAction).toHaveBeenCalledWith("merge_test_to_main:", expect.any(Function));
expect(bot.onAction).toHaveBeenCalledWith(expect.any(Function));
});

it("merges test to main and posts success", async () => {
mockMergeGithubBranch.mockResolvedValue({ ok: true });

const bot = createMockBot();
registerOnMergeTestToMainAction(bot);
const handler = bot.onAction.mock.calls[0][1];
const handler = bot.onAction.mock.calls[0][0];

const mockThread = { post: vi.fn() };

Expand All @@ -45,7 +45,7 @@ describe("registerOnMergeTestToMainAction", () => {

const bot = createMockBot();
registerOnMergeTestToMainAction(bot);
const handler = bot.onAction.mock.calls[0][1];
const handler = bot.onAction.mock.calls[0][0];

const mockThread = { post: vi.fn() };

Expand All @@ -61,7 +61,7 @@ describe("registerOnMergeTestToMainAction", () => {

const bot = createMockBot();
registerOnMergeTestToMainAction(bot);
const handler = bot.onAction.mock.calls[0][1];
const handler = bot.onAction.mock.calls[0][0];

const mockThread = { post: vi.fn() };

Expand Down
4 changes: 3 additions & 1 deletion lib/coding-agent/handlers/onMergeTestToMainAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { parseMergeTestToMainActionId } from "../parseMergeTestToMainActionId";
* @param bot
*/
export function registerOnMergeTestToMainAction(bot: CodingAgentBot) {
bot.onAction("merge_test_to_main:", async event => {
bot.onAction(async event => {
if (!event.actionId.startsWith("merge_test_to_main:")) return;

const thread = event.thread;

const repo = parseMergeTestToMainActionId(event.actionId);
Expand Down