SEO: a domain property (sc-domain:) covers every subdomain, so the shop, Gitea and forum were counted as the website. What ranks, the morning check, the Monday report, keywords, change candidates and the audit's traffic now read only the website's own host (with or without www). The report keeps pages worth a proposal apart from "Waiting for your yes", explains only moves past the thresholds, and says "places up/down". Also: - Feed summaries drop the posts' scripts and styles. - Spend you log can't be negative. - Test and check buttons can't be clicked twice while they run. - Previews show the site's web fonts and icon sprites. - Backups are read without leaving -wal/-shm files; deleting one removes them, and leftovers are swept at start. - The Overview's setup flags a CRM that Hermes can't reach. - Import now says what came in; adding a prospect that exists says so; prospects can be deleted. - Signal tags and brief addresses keep accented letters (Ü → u). - Page errors start with a capital; clearer messages for bad uploads, CRM retry and cancel, keywords, and the finished audit. - The module you're in stays unfolded in the sidebar. - A picked keyword can be unpicked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
71 lines
2.5 KiB
Go
71 lines
2.5 KiB
Go
package rss
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestParseRSS(t *testing.T) {
|
|
feed := `<?xml version="1.0" encoding="UTF-8"?>
|
|
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
<channel><title>Jitsi blog</title>
|
|
<item><title>Jitsi 3 & more</title><link>https://jitsi.org/blog/3</link>
|
|
<guid>jitsi-3</guid><pubDate>Mon, 02 Nov 2026 10:00:00 +0000</pubDate>
|
|
<description><![CDATA[<p>New <b>release</b>.</p>]]></description><dc:creator>Saúl</dc:creator></item>
|
|
<item><title>No date</title><link>https://jitsi.org/blog/x</link></item>
|
|
</channel></rss>`
|
|
items, err := Parse([]byte(feed), "Jitsi")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(items) != 2 {
|
|
t.Fatalf("got %d items", len(items))
|
|
}
|
|
it := items[0]
|
|
if it.Title != "Jitsi 3 & more" || it.Body != "New release ." || it.Author != "Saúl" || it.URL != "https://jitsi.org/blog/3" {
|
|
t.Errorf("item = %+v", it)
|
|
}
|
|
if !it.PublishedAt.Equal(time.Date(2026, 11, 2, 10, 0, 0, 0, time.UTC)) {
|
|
t.Errorf("date = %v", it.PublishedAt)
|
|
}
|
|
if !strings.HasPrefix(it.ID, "rss:") || it.ID == items[1].ID || it.AppName != "Jitsi" {
|
|
t.Errorf("ids %q %q", it.ID, items[1].ID)
|
|
}
|
|
if !items[1].PublishedAt.IsZero() || items[1].Author != "Jitsi blog" {
|
|
t.Errorf("undated item = %+v", items[1])
|
|
}
|
|
}
|
|
|
|
func TestParseAtom(t *testing.T) {
|
|
feed := `<feed xmlns="http://www.w3.org/2005/Atom"><title>Releases</title>
|
|
<entry><title>v2.0</title><id>tag:x,2026:2</id>
|
|
<link rel="alternate" href="https://example.com/v2"/><link rel="edit" href="https://example.com/edit"/>
|
|
<updated>2026-11-03T08:00:00Z</updated><summary>Faster.</summary><author><name>Ana</name></author></entry>
|
|
</feed>`
|
|
items, err := Parse([]byte(feed), "X")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(items) != 1 || items[0].URL != "https://example.com/v2" || items[0].Body != "Faster." || items[0].Author != "Ana" {
|
|
t.Fatalf("items = %+v", items)
|
|
}
|
|
}
|
|
|
|
func TestParseRejectsHTML(t *testing.T) {
|
|
if _, err := Parse([]byte(`<html><body>hi</body></html>`), "X"); err == nil {
|
|
t.Fatal("expected an error for an HTML page")
|
|
}
|
|
}
|
|
|
|
func TestCleanDropsScripts(t *testing.T) {
|
|
in := `<p>Table</p><script>document.addEventListener('DOMContentLoaded', function () { var x = 1; });</script>
|
|
<style>.nc-toc { color: red }</style><p>How to set up & share</p>`
|
|
if got := clean(in, 500); got != "Table How to set up & share" {
|
|
t.Errorf("clean = %q", got)
|
|
}
|
|
if got := clean(`<p>Hi</p><script>var a = 1;</script> there`, 500); got != "Hi there" {
|
|
t.Errorf("escaped: %q", got)
|
|
}
|
|
}
|