@@ -14,16 +14,17 @@ describe("LocalCheckpointer", () => {
14
14
let git : SimpleGit
15
15
let testFile : string
16
16
let initialCommit : CommitResult
17
+ const mainBranch = "my_branch"
18
+ const hiddenBranch = "checkpoints"
17
19
18
20
beforeEach ( async ( ) => {
19
21
// Create a temporary directory for testing.
20
22
tempDir = path . join ( os . tmpdir ( ) , `checkpointer-test-${ Date . now ( ) } ` )
21
23
await fs . mkdir ( tempDir )
22
- console . log ( tempDir )
23
24
24
25
// Initialize git repo.
25
26
git = simpleGit ( tempDir )
26
- await git . init ( )
27
+ await git . init ( [ "--initial-branch" , mainBranch ] )
27
28
await git . addConfig ( "user.name" , "Roo Code" )
28
29
await git . addConfig ( "user.email" , "[email protected] " )
29
30
@@ -36,11 +37,7 @@ describe("LocalCheckpointer", () => {
36
37
initialCommit = await git . commit ( "Initial commit" ) !
37
38
38
39
// 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 } )
44
41
} )
45
42
46
43
afterEach ( async ( ) => {
@@ -49,8 +46,9 @@ describe("LocalCheckpointer", () => {
49
46
} )
50
47
51
48
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 )
54
52
} )
55
53
56
54
it ( "saves and lists checkpoints" , async ( ) => {
@@ -61,7 +59,7 @@ describe("LocalCheckpointer", () => {
61
59
expect ( commit ?. commit ) . toBeTruthy ( )
62
60
63
61
const checkpoints = await checkpointer . listCheckpoints ( )
64
- expect ( checkpoints . length ) . toBeGreaterThan ( 0 )
62
+ expect ( checkpoints . length ) . toBe ( 2 )
65
63
expect ( checkpoints [ 0 ] . message ) . toBe ( commitMessage )
66
64
expect ( checkpoints [ 0 ] . hash ) . toBe ( commit ?. commit )
67
65
} )
0 commit comments