MCPcopy Create free account
hub / github.com/driangle/taskmd / TestAppendSourceURL

Function TestAppendSourceURL

apps/cli/internal/sync/import_engine_test.go:579–620  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

577}
578
579func TestAppendSourceURL(t *testing.T) {
580 tests := []struct {
581 name string
582 desc string
583 url string
584 expected string
585 }{
586 {
587 name: "with description and URL",
588 desc: "Some description",
589 url: "https://example.com",
590 expected: "Some description\n\n---\nSource: https://example.com",
591 },
592 {
593 name: "empty URL",
594 desc: "Description",
595 url: "",
596 expected: "Description",
597 },
598 {
599 name: "empty description with URL",
600 desc: "",
601 url: "https://example.com",
602 expected: "\n\n---\nSource: https://example.com",
603 },
604 {
605 name: "description with trailing newlines",
606 desc: "Body text\n\n",
607 url: "https://example.com",
608 expected: "Body text\n\n---\nSource: https://example.com",
609 },
610 }
611
612 for _, tt := range tests {
613 t.Run(tt.name, func(t *testing.T) {
614 got := appendSourceURL(tt.desc, tt.url)
615 if got != tt.expected {
616 t.Errorf("appendSourceURL(%q, %q) = %q, want %q", tt.desc, tt.url, got, tt.expected)
617 }
618 })
619 }
620}

Callers

nothing calls this directly

Calls 1

appendSourceURLFunction · 0.85

Tested by

no test coverage detected