(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func TestNextID_PrefixedIDs(t *testing.T) { |
| 110 | resetNextIDFlags() |
| 111 | |
| 112 | tmpDir := createNextIDTestFiles(t, map[string]string{ |
| 113 | "WEB-001.md": `--- |
| 114 | id: "WEB-001" |
| 115 | title: "Web task 1" |
| 116 | status: pending |
| 117 | priority: medium |
| 118 | created: 2026-02-14 |
| 119 | --- |
| 120 | `, |
| 121 | "WEB-002.md": `--- |
| 122 | id: "WEB-002" |
| 123 | title: "Web task 2" |
| 124 | status: pending |
| 125 | priority: medium |
| 126 | created: 2026-02-14 |
| 127 | --- |
| 128 | `, |
| 129 | "WEB-003.md": `--- |
| 130 | id: "WEB-003" |
| 131 | title: "Web task 3" |
| 132 | status: pending |
| 133 | priority: medium |
| 134 | created: 2026-02-14 |
| 135 | --- |
| 136 | `, |
| 137 | }) |
| 138 | |
| 139 | oldStdout := os.Stdout |
| 140 | r, w, _ := os.Pipe() |
| 141 | os.Stdout = w |
| 142 | |
| 143 | err := runNextID(nextIDCmd, []string{tmpDir}) |
| 144 | |
| 145 | w.Close() |
| 146 | os.Stdout = oldStdout |
| 147 | |
| 148 | if err != nil { |
| 149 | t.Fatalf("unexpected error: %v", err) |
| 150 | } |
| 151 | |
| 152 | var buf bytes.Buffer |
| 153 | buf.ReadFrom(r) |
| 154 | output := strings.TrimSpace(buf.String()) |
| 155 | |
| 156 | if output != "WEB-004" { |
| 157 | t.Errorf("expected WEB-004, got %q", output) |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | func TestNextID_JSONFormat(t *testing.T) { |
| 162 | resetNextIDFlags() |
nothing calls this directly
no test coverage detected