Skip to content
Open
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
25 changes: 25 additions & 0 deletions src/commands/__tests__/generateCommitMessage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,31 @@ describe("generateCommitMessage", () => {
);
});

it("includes branch and author in request for template interpolation", async () => {
const mockStreamCommitMessage = jest.fn().mockImplementation(async function* () {
yield "Test message";
});
mockFireworksProvider.prototype.streamCommitMessage = mockStreamCommitMessage;

mockGetCurrentBranch.mockReturnValue("feature/WEBAPP-123");
mockGetCurrentAuthor.mockReturnValue("John Doe");
mockReadConfiguration.mockReturnValue({
success: true,
data: "Branch: {{branch}}\nAuthor: {{author}}",
});

await generateCommitMessage(mockSourceControl, mockContext);

expect(mockStreamCommitMessage).toHaveBeenCalledWith(
expect.objectContaining({
branch: "feature/WEBAPP-123",
author: "John Doe",
override: "Branch: {{branch}}\nAuthor: {{author}}",
}),
expect.any(Object)
);
});

it("passes undefined override when config read fails", async () => {
const mockStreamCommitMessage = jest.fn().mockImplementation(async function* () {
yield "Test message";
Expand Down
Loading