MCPcopy Create free account
hub / github.com/driangle/taskmd / TestLoadConfig_Valid

Function TestLoadConfig_Valid

apps/cli/internal/sync/config_test.go:9–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestLoadConfig_Valid(t *testing.T) {
10 dir := t.TempDir()
11 content := `sync:
12 sources:
13 - name: github
14 project: "owner/repo"
15 token_env: "GITHUB_TOKEN"
16 output_dir: "tasks/github"
17 field_map:
18 status:
19 open: pending
20 closed: completed
21 priority:
22 p0: critical
23 labels_to_tags: true
24 assignee_to_owner: true
25 filters:
26 labels: ["task"]
27`
28 writeFile(t, filepath.Join(dir, ".taskmd.yaml"), content)
29
30 cfg, err := LoadConfig(dir)
31 if err != nil {
32 t.Fatalf("unexpected error: %v", err)
33 }
34
35 if len(cfg.Sources) != 1 {
36 t.Fatalf("expected 1 source, got %d", len(cfg.Sources))
37 }
38
39 s := cfg.Sources[0]
40 if s.Name != "github" {
41 t.Errorf("expected name=github, got %q", s.Name)
42 }
43 if s.Project != "owner/repo" {
44 t.Errorf("expected project=owner/repo, got %q", s.Project)
45 }
46 if s.OutputDir != "tasks/github" {
47 t.Errorf("expected output_dir=tasks/github, got %q", s.OutputDir)
48 }
49 if s.FieldMap.Status["open"] != "pending" {
50 t.Errorf("expected status.open=pending, got %q", s.FieldMap.Status["open"])
51 }
52 if !s.FieldMap.LabelsToTags {
53 t.Error("expected labels_to_tags=true")
54 }
55 if !s.FieldMap.AssigneeToOwner {
56 t.Error("expected assignee_to_owner=true")
57 }
58}
59
60func TestLoadConfig_MultipleSources(t *testing.T) {
61 dir := t.TempDir()

Callers

nothing calls this directly

Calls 3

LoadConfigFunction · 0.85
ErrorMethod · 0.80
writeFileFunction · 0.70

Tested by

no test coverage detected