package search import ( "testing" "github.com/stretchr/testify/assert" ) // Only the leading frontmatter is provenance; a body line that looks like a // key is prose (the doc comment's claim, now observed). func TestExtractProvenanceIgnoresBodyLines(t *testing.T) { o, w := extractProvenance("---\ntitle: t\n---\norigin: static\nwritten_by: local-cli\n") assert.Equal(t, "", o) assert.Equal(t, "", w) o, w = extractProvenance("# no frontmatter\norigin: static\n") assert.Equal(t, "", o) assert.Equal(t, "", w) o, w = extractProvenance("---\norigin: jwt\nwritten_by: attacker\n---\norigin: static\n") assert.Equal(t, "jwt", o) assert.Equal(t, "attacker", w) }