-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: add missing import and update tests for branch template feature #799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,10 @@ const NUM_DESCRIPTION_WORDS = 5; | |
| /** | ||
| * Extracts the first `numWords` words from a title and converts them to kebab-case | ||
| */ | ||
|
||
| function extractDescription(title: string, numWords: number = NUM_DESCRIPTION_WORDS): string { | ||
| function extractDescription( | ||
| title: string, | ||
| numWords: number = NUM_DESCRIPTION_WORDS, | ||
| ): string { | ||
| if (!title || title.trim() === "") { | ||
| return ""; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,7 +156,7 @@ describe("branch template utilities", () => { | |
| "Fix login bug with OAuth", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a test with a title containing more than 5 words to explicitly verify truncation behavior: it("should truncate descriptions to exactly 5 words from longer titles", () => {
const result = generateBranchName(
"{{prefix}}{{description}}/{{entityNumber}}",
"feature/",
"issue",
999,
undefined,
undefined,
"This is a very long title with many more than five words in it"
);
expect(result).toBe("feature/this-is-a-very-long/999");
});This would definitively verify the |
||
| ); | ||
|
|
||
| expect(result).toBe("feature/fix-login-bug/123"); | ||
| expect(result).toBe("feature/fix-login-bug-with-oauth/123"); | ||
| }); | ||
|
|
||
| it("should handle template with multiple variables including description", () => { | ||
|
|
@@ -172,7 +172,9 @@ describe("branch template utilities", () => { | |
| "User authentication fails completely", | ||
| ); | ||
|
|
||
| expect(result).toBe("dev/bug/user-authentication-fails-issue_456"); | ||
| expect(result).toBe( | ||
| "dev/bug/user-authentication-fails-completely-issue_456", | ||
| ); | ||
| }); | ||
|
|
||
| it("should handle description with special characters in template", () => { | ||
|
|
@@ -187,7 +189,7 @@ describe("branch template utilities", () => { | |
| "Add: User Registration & Email Validation", | ||
| ); | ||
|
|
||
| expect(result).toBe("fix/add-user-registration-789"); | ||
| expect(result).toBe("fix/add-user-registration-email-789"); | ||
| }); | ||
|
|
||
| it("should handle empty description in template", () => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.