@@ -275,10 +275,11 @@ Deno.test("file not in target branch should be deleted", async (t) => {
275
275
} ) ;
276
276
} ) ;
277
277
278
- await doWithTempDir ( async ( tempDir ) => {
278
+ // First temp directory for feature branch checkout
279
+ await doWithTempDir ( async ( featureTempDir ) => {
279
280
await t . step ( "checkout feature branch" , async ( ) => {
280
281
await checkout ( {
281
- targetDir : tempDir ,
282
+ targetDir : featureTempDir ,
282
283
projectId : project . id ,
283
284
branchId : featureBranch . id ,
284
285
fromBranchId : featureBranch . id ,
@@ -287,36 +288,43 @@ Deno.test("file not in target branch should be deleted", async (t) => {
287
288
} ) ;
288
289
289
290
assert (
290
- await exists ( join ( tempDir , "feature.txt" ) ) ,
291
+ await exists ( join ( featureTempDir , "feature.txt" ) ) ,
291
292
"feature file should exist" ,
292
293
) ;
293
294
} ) ;
294
295
295
296
await t . step ( "create local file" , async ( ) => {
296
- await Deno . writeTextFile ( join ( tempDir , "local.txt" ) , "local content" ) ;
297
+ await Deno . writeTextFile (
298
+ join ( featureTempDir , "local.txt" ) ,
299
+ "local content" ,
300
+ ) ;
297
301
} ) ;
298
302
299
- await t . step ( "checkout main branch" , async ( ) => {
300
- await checkout ( {
301
- targetDir : tempDir ,
302
- projectId : project . id ,
303
- branchId : mainBranch . id ,
304
- fromBranchId : featureBranch . id ,
305
- version : mainBranch . version + 1 ,
306
- gitignoreRules : [ ] ,
303
+ // Second temp directory for main branch checkout
304
+ await doWithTempDir ( async ( mainTempDir ) => {
305
+ await t . step ( "checkout main branch" , async ( ) => {
306
+ await checkout ( {
307
+ targetDir : mainTempDir ,
308
+ projectId : project . id ,
309
+ branchId : mainBranch . id ,
310
+ fromBranchId : featureBranch . id ,
311
+ } ) ;
307
312
} ) ;
308
- } ) ;
309
313
310
- await t . step ( "verify file states" , async ( ) => {
311
- assert (
312
- ! await exists ( join ( tempDir , "feature.txt" ) ) ,
313
- "feature file should be deleted" ,
314
- ) ;
315
- assert (
316
- await exists ( join ( tempDir , "local.txt" ) ) ,
317
- "local file should be preserved" ,
318
- ) ;
319
- } ) ;
320
- } , "vt_checkout_deletion_test_" ) ;
314
+ await t . step ( "verify file states" , async ( ) => {
315
+ assert (
316
+ ! await exists ( join ( mainTempDir , "feature.txt" ) ) ,
317
+ "feature file should be deleted" ,
318
+ ) ;
319
+
320
+ // Local file should not exist in the main branch temp dir
321
+ // since it's a different directory
322
+ assert (
323
+ ! await exists ( join ( mainTempDir , "local.txt" ) ) ,
324
+ "local file should not exist in main branch directory" ,
325
+ ) ;
326
+ } ) ;
327
+ } , "vt_checkout_main_branch_test_" ) ;
328
+ } , "vt_checkout_feature_branch_test_" ) ;
321
329
} ) ;
322
330
} ) ;
0 commit comments