✨ feat(tui): 状态评论改用隐藏格式读写,已知字段改从 schema 派生

This commit is contained in:
cruldra committed 2026-10-19 07:27:01 +11:00
1 parent 9d1bb06f38
commit a23c88e812
5 files changed
+423 -50

No files matched your search

+10 -2
View File
@@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"testing"
"superwork-tui/internal/gitea"
@@ -240,9 +241,16 @@ func TestLoadIssues_MissingStateSeeded(t *testing.T) {
if got.Column != issue.ColumnTodo {
t.Errorf("column: got %v, want todo", got.Column)
}
// A seed comment must have been posted
// A seed comment must have been posted, in the hidden state format
if len(client.posted) != 1 {
t.Errorf("expected 1 posted comment, got %d", len(client.posted))
t.Fatalf("expected 1 posted comment, got %d", len(client.posted))
}
if !strings.HasPrefix(client.posted[0], "<!-- spx-state\n") {
t.Errorf("seed body %q is not in the hidden state format", client.posted[0])
}
seed, ok := issue.ParseStateComment(client.posted[0])
if !ok || seed["column"] != "todo" {
t.Errorf("seed state = %v (ok=%v), want column=todo", seed, ok)
}
}