package memory import ( "regexp" "strings" "testing" ) func TestNormalizeMemoryDayContent_StructuredJSON(t *testing.T) { path := "/data/memory/2026-03-01.md" input := `[ { "topic": "Decision", "memory": "Choose provider architecture." } ]` out := NormalizeMemoryDayContent(path, input) if !strings.Contains(out, "# Memory 2026-03-01") { t.Fatalf("expected day header, got: %s", out) } if !strings.Contains(out, ` 结论:采用 provider 架构 用户偏好:简短回复 ` out := RenderMemoryDayForDisplay(path, raw) if strings.Contains(out, "MEMOH:ENTRY") { t.Fatalf("display output should hide raw markers: %s", out) } if !strings.Contains(out, "# 2026-03-01") { t.Fatalf("expected display day header, got: %s", out) } if !strings.Contains(out, "## 09:40 AM - Decision") { t.Fatalf("expected timeline section, got: %s", out) } if !strings.Contains(out, "- 结论:采用 provider 架构") { t.Fatalf("expected bulletized body, got: %s", out) } if !strings.Contains(out, "## 11:15 AM - Notes") { t.Fatalf("expected second timeline section, got: %s", out) } } func TestRenderMemoryDayForDisplay_NonMemoryPathUnchanged(t *testing.T) { raw := "plain content" out := RenderMemoryDayForDisplay("/data/notes.md", raw) if out != raw { t.Fatalf("non-memory path should be unchanged, got: %s", out) } }