Builds internal/adapter and cmd/adapter: the three contracts/r1.openapi.yaml operations, idempotency on post_id, the reviewed_by/consent-basis refusals, per-form (R-2/R-3) length limits, and Markdown-to-Telegram rendering, all against a Sender interface so it's testable without a live bot token. Every other open task in FT-WP-0001 and FT-WP-0002 needs something this repo can't supply on its own: the human session bootstrap in FT-WP-0002 T01, the fluid CLI from fluid-core, or a person's judgment (consent basis, editorial review, publishing pace). Set both workplans to status: blocked and flagged FT-WP-0002-T01 needs_human on the hub, since it's the single blocker gating everything else. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: sonnet Assistant-Process: 278411@bnt-lap001 Assistant-Session: 19568045-15bc-4b88-ba3d-8e95b4f9c6f1
40 lines
1 KiB
Go
40 lines
1 KiB
Go
package adapter
|
|
|
|
import "testing"
|
|
|
|
func TestRenderHTML(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
in string
|
|
want string
|
|
}{
|
|
{"heading", "# Title\nbody", "<b>Title</b>\nbody"},
|
|
{"bold", "this is **bold** text", "this is <b>bold</b> text"},
|
|
{"italic", "this is _italic_ text", "this is <i>italic</i> text"},
|
|
{"link", "see [the entry](https://example.com/e/1)", `see <a href="https://example.com/e/1">the entry</a>`},
|
|
{"code", "```go\nfmt.Println(1)\n```", "<pre>fmt.Println(1)</pre>"},
|
|
{
|
|
"table",
|
|
"| a | b |\n|---|---|\n| 1 | 2 |",
|
|
"a — b\n\n1 — 2",
|
|
},
|
|
}
|
|
for _, tc := range cases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
got, err := RenderHTML(tc.in)
|
|
if err != nil {
|
|
t.Fatalf("RenderHTML(%q): %v", tc.in, err)
|
|
}
|
|
if got != tc.want {
|
|
t.Errorf("RenderHTML(%q) = %q, want %q", tc.in, got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestRenderHTMLRejectsRawAngleBrackets(t *testing.T) {
|
|
_, err := RenderHTML("a <script> tag")
|
|
if err == nil {
|
|
t.Fatal("expected an error for raw angle brackets")
|
|
}
|
|
}
|