summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_site_basics.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests/test_site_basics.py')
-rw-r--r--packages/meshbay-hub/tests/test_site_basics.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_site_basics.py b/packages/meshbay-hub/tests/test_site_basics.py
index 5c19aa6..40508a1 100644
--- a/packages/meshbay-hub/tests/test_site_basics.py
+++ b/packages/meshbay-hub/tests/test_site_basics.py
@@ -93,3 +93,36 @@ def test_the_preview_description_fits_in_a_preview():
nothing."""
from meshbay_hub.api.webapp import PREVIEW_DESCRIPTION
assert len(PREVIEW_DESCRIPTION) <= 60
+
+
+def test_search_engines_get_a_title_and_description_that_say_what_it_is(client):
+ """The preview description is cut for messengers; a search result has
+ room for two lines, and a bare "MeshBay" title matches no search."""
+ from meshbay_hub.api.webapp import SEARCH_DESCRIPTION, SEARCH_TITLE
+ html = client.get("/").text
+ assert f"<title>{SEARCH_TITLE}</title>" in html
+ assert 50 <= len(SEARCH_TITLE) <= 60
+ assert re.search(r'<meta name="description" content="([^"]*)">', html).group(1) == SEARCH_DESCRIPTION
+ assert 110 <= len(SEARCH_DESCRIPTION) <= 160
+
+
+def test_every_path_to_the_shell_names_the_root_as_canonical():
+ from meshbay_hub.config import load_config
+ cfg = load_config()
+ cfg.identity.id = "hub.example.org"
+ client = TestClient(create_app(cfg))
+ for path in ("/", "/app", "/app/groups"):
+ html = client.get(path).text
+ assert '<link rel="canonical" href="https://hub.example.org/">' in html, path
+
+
+def test_the_shell_has_text_and_links_without_scripts(client):
+ """A crawler that does not run app.js reads the <noscript> block and
+ nothing else, so it must carry the pitch and the links to follow."""
+ html = client.get("/").text
+ m = re.search(r"<noscript>(.*?)</noscript>", html, re.S)
+ assert m, "no <noscript> block"
+ links = re.findall(r'href="([^"]+)"', m.group(1))
+ assert "https://meshbay.org/downloads/" in links
+ assert any(link.endswith("docs/QUICKSTART.md") for link in links)
+ assert "<h1>" in m.group(1)