Skip to content

Commit 02361b9

Browse files
committed
build: tests for publication handler
1 parent 502828d commit 02361b9

File tree

4 files changed

+357
-16
lines changed

4 files changed

+357
-16
lines changed

internal/handlers/articles.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// TODO: more article sanitizing
12
package handlers
23

34
import (

internal/handlers/publication.go

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
// Package handlers provides command handlers for leaflet publication operations.
22
//
3-
// Pull command:
4-
// 1. Authenticates with AT Protocol
5-
// 2. Fetches all pub.leaflet.document records
6-
// 3. Creates new notes for documents not seen before
7-
// 4. Updates existing notes (matched by leaflet_rkey)
8-
// 5. Shows summary of pulled documents
9-
//
10-
// List command:
11-
// 1. Query notes where leaflet_rkey IS NOT NULL
12-
// 2. Apply filter (published vs draft) - "all", "published", "draft", or empty (default: all)
13-
// 3. Static output (TUI viewing marked as TODO)
14-
//
3+
// TODO: Post (create 1)
4+
// TODO: Push (create or update - more than 1)
155
// TODO: Add TUI viewing for document details
166
package handlers
177

@@ -160,7 +150,7 @@ func (h *PublicationHandler) Pull(ctx context.Context) error {
160150
if err == nil && existing != nil {
161151
content, err := documentToMarkdown(doc)
162152
if err != nil {
163-
ui.Warningln("Skipping document %s: %v", doc.Document.Title, err)
153+
ui.Warningln("Skipping document %s: %v", doc.Document.Title, err)
164154
continue
165155
}
166156

@@ -177,7 +167,7 @@ func (h *PublicationHandler) Pull(ctx context.Context) error {
177167
}
178168

179169
if err := h.repos.Notes.Update(ctx, existing); err != nil {
180-
ui.Warningln("Failed to update note for document %s: %v", doc.Document.Title, err)
170+
ui.Warningln("Failed to update note for document %s: %v", doc.Document.Title, err)
181171
continue
182172
}
183173

@@ -186,7 +176,7 @@ func (h *PublicationHandler) Pull(ctx context.Context) error {
186176
} else {
187177
content, err := documentToMarkdown(doc)
188178
if err != nil {
189-
ui.Warningln("Skipping document %s: %v", doc.Document.Title, err)
179+
ui.Warningln("Skipping document %s: %v", doc.Document.Title, err)
190180
continue
191181
}
192182

@@ -207,7 +197,7 @@ func (h *PublicationHandler) Pull(ctx context.Context) error {
207197

208198
_, err = h.repos.Notes.Create(ctx, note)
209199
if err != nil {
210-
ui.Warningln("Failed to create note for document %s: %v", doc.Document.Title, err)
200+
ui.Warningln("Failed to create note for document %s: %v", doc.Document.Title, err)
211201
continue
212202
}
213203

0 commit comments

Comments
 (0)