@@ -14,16 +14,17 @@ describe("LocalCheckpointer", () => {
1414 let git : SimpleGit
1515 let testFile : string
1616 let initialCommit : CommitResult
17+ const mainBranch = "my_branch"
18+ const hiddenBranch = "checkpoints"
1719
1820 beforeEach ( async ( ) => {
1921 // Create a temporary directory for testing.
2022 tempDir = path . join ( os . tmpdir ( ) , `checkpointer-test-${ Date . now ( ) } ` )
2123 await fs . mkdir ( tempDir )
22- console . log ( tempDir )
2324
2425 // Initialize git repo.
2526 git = simpleGit ( tempDir )
26- await git . init ( )
27+ await git . init ( [ "--initial-branch" , mainBranch ] )
2728 await git . addConfig ( "user.name" , "Roo Code" )
2829 await git . addConfig ( "user.email" , "[email protected] " ) 2930
@@ -36,11 +37,7 @@ describe("LocalCheckpointer", () => {
3637 initialCommit = await git . commit ( "Initial commit" ) !
3738
3839 // Create checkpointer instance.
39- checkpointer = await LocalCheckpointer . create ( {
40- workspacePath : tempDir ,
41- mainBranch : "main" ,
42- hiddenBranch : "checkpoints" ,
43- } )
40+ checkpointer = await LocalCheckpointer . create ( { workspacePath : tempDir , mainBranch, hiddenBranch } )
4441 } )
4542
4643 afterEach ( async ( ) => {
@@ -49,8 +46,9 @@ describe("LocalCheckpointer", () => {
4946 } )
5047
5148 it ( "creates a hidden branch on initialization" , async ( ) => {
52- const branches = await git . branch ( )
53- expect ( branches . all ) . toContain ( "checkpoints" )
49+ const { all : branches } = await git . branch ( )
50+ expect ( branches ) . toContain ( mainBranch )
51+ expect ( branches ) . toContain ( hiddenBranch )
5452 } )
5553
5654 it ( "saves and lists checkpoints" , async ( ) => {
@@ -61,7 +59,7 @@ describe("LocalCheckpointer", () => {
6159 expect ( commit ?. commit ) . toBeTruthy ( )
6260
6361 const checkpoints = await checkpointer . listCheckpoints ( )
64- expect ( checkpoints . length ) . toBeGreaterThan ( 0 )
62+ expect ( checkpoints . length ) . toBe ( 2 )
6563 expect ( checkpoints [ 0 ] . message ) . toBe ( commitMessage )
6664 expect ( checkpoints [ 0 ] . hash ) . toBe ( commit ?. commit )
6765 } )
0 commit comments