@@ -4,44 +4,48 @@ import { deriveBranchName } from "./deriveBranchName";
44describe ( "deriveBranchName" , ( ) => {
55 it ( "converts a simple title to a branch name" , ( ) => {
66 expect ( deriveBranchName ( "Fix authentication login bug" , "abc123" ) ) . toBe (
7- "posthog/fix-authentication-login-bug" ,
7+ "posthog-code /fix-authentication-login-bug" ,
88 ) ;
99 } ) ;
1010
1111 it ( "handles special characters" , ( ) => {
1212 expect ( deriveBranchName ( "PostHog issue #1234" , "abc123" ) ) . toBe (
13- "posthog/posthog-issue-1234" ,
13+ "posthog-code /posthog-issue-1234" ,
1414 ) ;
1515 } ) ;
1616
1717 it ( "collapses consecutive dashes" , ( ) => {
1818 expect ( deriveBranchName ( "Fix the bug" , "abc123" ) ) . toBe (
19- "posthog/fix-the-bug" ,
19+ "posthog-code /fix-the-bug" ,
2020 ) ;
2121 } ) ;
2222
2323 it ( "strips leading and trailing dashes" , ( ) => {
24- expect ( deriveBranchName ( " Fix bug " , "abc123" ) ) . toBe ( "posthog/fix-bug" ) ;
24+ expect ( deriveBranchName ( " Fix bug " , "abc123" ) ) . toBe (
25+ "posthog-code/fix-bug" ,
26+ ) ;
2527 } ) ;
2628
2729 it ( "truncates long titles" , ( ) => {
2830 const longTitle =
2931 "This is a very long task title that should be truncated to a reasonable length for git" ;
3032 const result = deriveBranchName ( longTitle , "abc123" ) ;
31- expect ( result . length ) . toBeLessThanOrEqual ( 68 ) ; // 60 slug + "posthog/" prefix
32- expect ( result . startsWith ( "posthog/" ) ) . toBe ( true ) ;
33+ expect ( result . length ) . toBeLessThanOrEqual ( 73 ) ; // 60 slug + "posthog-code /" prefix
34+ expect ( result . startsWith ( "posthog-code /" ) ) . toBe ( true ) ;
3335 expect ( result . endsWith ( "-" ) ) . toBe ( false ) ;
3436 } ) ;
3537
3638 it ( "falls back to task ID when title is empty" , ( ) => {
37- expect ( deriveBranchName ( "" , "abc123" ) ) . toBe ( "posthog/task-abc123" ) ;
39+ expect ( deriveBranchName ( "" , "abc123" ) ) . toBe ( "posthog-code /task-abc123" ) ;
3840 } ) ;
3941
4042 it ( "falls back to task ID when title is only whitespace" , ( ) => {
41- expect ( deriveBranchName ( " " , "abc123" ) ) . toBe ( "posthog/task-abc123" ) ;
43+ expect ( deriveBranchName ( " " , "abc123" ) ) . toBe ( "posthog-code /task-abc123" ) ;
4244 } ) ;
4345
4446 it ( "falls back to task ID when title is only special characters" , ( ) => {
45- expect ( deriveBranchName ( "!@#$%" , "abc123" ) ) . toBe ( "posthog/task-abc123" ) ;
47+ expect ( deriveBranchName ( "!@#$%" , "abc123" ) ) . toBe (
48+ "posthog-code/task-abc123" ,
49+ ) ;
4650 } ) ;
4751} ) ;
0 commit comments