(t *testing.T)
| 32 | } |
| 33 | |
| 34 | func TestEngine_CreateNewTasks(t *testing.T) { |
| 35 | sourceName := "test-create" |
| 36 | defer cleanupRegistry(sourceName) |
| 37 | |
| 38 | setupMockSource(sourceName, []ExternalTask{ |
| 39 | { |
| 40 | ExternalID: "EXT-1", |
| 41 | Title: "First task", |
| 42 | Description: "Task one description", |
| 43 | Status: "open", |
| 44 | Priority: "p1", |
| 45 | Labels: []string{"bug"}, |
| 46 | }, |
| 47 | { |
| 48 | ExternalID: "EXT-2", |
| 49 | Title: "Second task", |
| 50 | Description: "Task two description", |
| 51 | Status: "open", |
| 52 | }, |
| 53 | }) |
| 54 | |
| 55 | dir := t.TempDir() |
| 56 | outputDir := filepath.Join(dir, "tasks") |
| 57 | |
| 58 | engine := &Engine{ConfigDir: dir, Verbose: false} |
| 59 | srcCfg := SourceConfig{ |
| 60 | Name: sourceName, |
| 61 | OutputDir: outputDir, |
| 62 | FieldMap: FieldMap{ |
| 63 | Status: map[string]string{"open": "pending"}, |
| 64 | Priority: map[string]string{"p1": "high"}, |
| 65 | LabelsToTags: true, |
| 66 | }, |
| 67 | } |
| 68 | |
| 69 | result, err := engine.RunSync(srcCfg) |
| 70 | if err != nil { |
| 71 | t.Fatalf("unexpected error: %v", err) |
| 72 | } |
| 73 | |
| 74 | if len(result.Created) != 2 { |
| 75 | t.Fatalf("expected 2 created, got %d", len(result.Created)) |
| 76 | } |
| 77 | if len(result.Updated) != 0 { |
| 78 | t.Errorf("expected 0 updated, got %d", len(result.Updated)) |
| 79 | } |
| 80 | if len(result.Conflicts) != 0 { |
| 81 | t.Errorf("expected 0 conflicts, got %d", len(result.Conflicts)) |
| 82 | } |
| 83 | |
| 84 | // Verify files were created |
| 85 | for _, a := range result.Created { |
| 86 | if _, err := os.Stat(a.FilePath); os.IsNotExist(err) { |
| 87 | t.Errorf("expected file to exist: %s", a.FilePath) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // Verify state was saved |
nothing calls this directly
no test coverage detected