(t *testing.T)
| 586 | } |
| 587 | |
| 588 | func TestCollectArchivedIDs(t *testing.T) { |
| 589 | tmpDir := t.TempDir() |
| 590 | |
| 591 | // Create archive directory with task files |
| 592 | archiveDir := filepath.Join(tmpDir, "archive") |
| 593 | if err := os.MkdirAll(archiveDir, 0755); err != nil { |
| 594 | t.Fatalf("failed to create archive dir: %v", err) |
| 595 | } |
| 596 | |
| 597 | tasks := map[string]string{ |
| 598 | "050-done.md": `--- |
| 599 | id: "050" |
| 600 | title: "Archived 050" |
| 601 | status: completed |
| 602 | --- |
| 603 | Done. |
| 604 | `, |
| 605 | "051-done.md": `--- |
| 606 | id: "051" |
| 607 | title: "Archived 051" |
| 608 | status: completed |
| 609 | --- |
| 610 | Done. |
| 611 | `, |
| 612 | } |
| 613 | for name, content := range tasks { |
| 614 | if err := os.WriteFile(filepath.Join(archiveDir, name), []byte(content), 0644); err != nil { |
| 615 | t.Fatalf("failed to create test file: %v", err) |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | s := scanner.NewScanner(tmpDir, false, nil) |
| 620 | ids := collectArchivedIDs(s) |
| 621 | |
| 622 | if len(ids) != 2 { |
| 623 | t.Fatalf("expected 2 archived IDs, got %d", len(ids)) |
| 624 | } |
| 625 | if !ids["050"] { |
| 626 | t.Error("expected archived ID '050'") |
| 627 | } |
| 628 | if !ids["051"] { |
| 629 | t.Error("expected archived ID '051'") |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | func TestCollectArchivedIDs_NoArchive(t *testing.T) { |
| 634 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected