Files
magpie/internal/sessions/transcript_opencode_test.go
liubing 5d3d494431 sessions: reproduce missing editor histories and unreadable conversations (#1743)
The new Go tests fail on upstream 6a8b2c68 with missing editor sessions and ErrNoTranscript; the date-range UI test fails on the missing history shortcut.
2026-10-13 06:43:50 +08:00

30 lines
796 B
Go

package sessions
import (
"path/filepath"
"testing"
)
func TestTranscriptOpenCodeV2(t *testing.T) {
data, _ := setupMore(t)
db := ocMakeV2(t, filepath.Join(data, "opencode", "opencode.db"))
defer db.Close()
s := find(t, List(All), "opencode", ocMain)
tr, err := TranscriptOf(s)
if err != nil || len(tr.Parts) != 4 {
t.Fatalf("OpenCode conversation parts=%d error=%v", len(tr.Parts), err)
}
if tr.Parts[0].Role != "user" || tr.Parts[3].Text != "It races the clock." {
t.Fatalf("wrong conversation order: %+v", tr)
}
}
func TestTranscriptOpenCodeFiles(t *testing.T) {
setupMore(t)
s := find(t, List(All), "opencode", ocMain)
tr, err := TranscriptOf(s)
if err != nil || len(tr.Parts) == 0 {
t.Fatalf("legacy OpenCode conversation parts=%d error=%v", len(tr.Parts), err)
}
}