Skip to content

Commit a8df0ff

Browse files
committed
fix: move executor issue
1 parent d484308 commit a8df0ff

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

src/__tests__/MoveActionExecutor.test.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ describe("MoveActionExecutor", () => {
263263
## Completed Tasks
264264
- [x] Previous completed task
265265
- [x] Task to move
266-
267266
## Other Section
268267
- [ ] Some other task`;
269268

@@ -282,14 +281,16 @@ describe("MoveActionExecutor", () => {
282281

283282
expect(result.success).toBe(true);
284283

285-
// Verify source file was updated (task removed)
286-
expect(mockVault.modify).toHaveBeenCalledWith(
284+
// Verify source file was updated (task removed) - first call
285+
expect(mockVault.modify).toHaveBeenNthCalledWith(
286+
1,
287287
{ path: "current.md" },
288288
expectedSourceContent
289289
);
290290

291-
// Verify target file was updated (task added)
292-
expect(mockVault.modify).toHaveBeenCalledWith(
291+
// Verify target file was updated (task added) - second call
292+
expect(mockVault.modify).toHaveBeenNthCalledWith(
293+
2,
293294
{ path: "archive.md" },
294295
expectedTargetContent
295296
);
@@ -344,14 +345,16 @@ describe("MoveActionExecutor", () => {
344345

345346
expect(result.success).toBe(true);
346347

347-
// Verify source file was updated (task removed)
348-
expect(mockVault.modify).toHaveBeenCalledWith(
348+
// Verify source file was updated (task removed) - first call
349+
expect(mockVault.modify).toHaveBeenNthCalledWith(
350+
1,
349351
{ path: "current.md" },
350352
expectedSourceContent
351353
);
352354

353-
// Verify target file was updated (task added)
354-
expect(mockVault.modify).toHaveBeenCalledWith(
355+
// Verify target file was updated (task added) - second call
356+
expect(mockVault.modify).toHaveBeenNthCalledWith(
357+
2,
355358
{ path: "archive.md" },
356359
expectedTargetContent
357360
);
@@ -444,14 +447,16 @@ describe("MoveActionExecutor", () => {
444447

445448
expect(result.success).toBe(true);
446449

447-
// Verify source file was updated (task removed)
448-
expect(mockVault.modify).toHaveBeenCalledWith(
450+
// Verify source file was updated (task removed) - first call
451+
expect(mockVault.modify).toHaveBeenNthCalledWith(
452+
1,
449453
{ path: "current.md" },
450454
expectedSourceContent
451455
);
452456

453-
// Verify target file was updated (task added)
454-
expect(mockVault.modify).toHaveBeenCalledWith(
457+
// Verify target file was updated (task added) - second call
458+
expect(mockVault.modify).toHaveBeenNthCalledWith(
459+
2,
455460
{ path: "archive/completed.md" },
456461
expectedTargetContent
457462
);
@@ -551,14 +556,16 @@ describe("MoveActionExecutor", () => {
551556

552557
expect(result.success).toBe(true);
553558

554-
// Verify source file was updated (task removed)
555-
expect(mockVault.modify).toHaveBeenCalledWith(
559+
// Verify source file was updated (task removed) - first call
560+
expect(mockVault.modify).toHaveBeenNthCalledWith(
561+
1,
556562
{ path: "current.md" },
557563
expectedSourceContent
558564
);
559565

560-
// Verify target file was updated (task added)
561-
expect(mockVault.modify).toHaveBeenCalledWith(
566+
// Verify target file was updated (task added) - second call
567+
expect(mockVault.modify).toHaveBeenNthCalledWith(
568+
2,
562569
{ path: "archive.md" },
563570
expectedTargetContent
564571
);

0 commit comments

Comments
 (0)