fancy theme
This commit is contained in:
@@ -22,6 +22,31 @@ const fixture = `{
|
||||
Keep {braces} in the body.
|
||||
`
|
||||
|
||||
func TestActualPiExtensionFixtureRoundTrip(t *testing.T) {
|
||||
// Captured from a todo created by Pi's todo extension (not hand-written).
|
||||
data, err := os.ReadFile("testdata/pi-created.md")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
parsed, err := Parse("1ddf1df4", data)
|
||||
if err != nil || parsed.Title != "TodoApp compatibility probe" || parsed.Status != "open" || len(parsed.Tags) != 2 || parsed.Body != "# Compatibility\n\nCreated by the Pi todo extension for TodoApp tests.\n" {
|
||||
t.Fatalf("could not read Pi fixture: %+v, %v", parsed, err)
|
||||
}
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, parsed.ID+".md")
|
||||
if err := os.WriteFile(path, data, 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
parsed.Title = "Edited in TodoApp"
|
||||
if err := Update(dir, parsed); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
updated, err := Read(dir, parsed.ID)
|
||||
if err != nil || updated.Title != "Edited in TodoApp" || updated.CreatedAt != parsed.CreatedAt || updated.Body != parsed.Body {
|
||||
t.Fatalf("Pi fixture round-trip failed: %+v, %v", updated, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseAndSerializePiFixture(t *testing.T) {
|
||||
todo, err := Parse("deadbeef", []byte(fixture))
|
||||
if err != nil {
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"id": "1ddf1df4",
|
||||
"title": "TodoApp compatibility probe",
|
||||
"tags": [
|
||||
"compat",
|
||||
"pi"
|
||||
],
|
||||
"status": "open",
|
||||
"created_at": "2026-11-04T15:58:40.258Z"
|
||||
}
|
||||
|
||||
# Compatibility
|
||||
|
||||
Created by the Pi todo extension for TodoApp tests.
|
||||
Reference in New Issue
Block a user