summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-15 14:33:03 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-15 14:33:03 +0200
commit37b38e0eb15a79bbda3cd0a1b502669b32e773dc (patch)
tree7c2b44576358b53ec6381312cca3b73b1f4506a0 /packages/meshbay-hub/tests
parent28c77b7648b2a44a18be64ec44344d91cccfd742 (diff)
downloadmeshbay-37b38e0eb15a79bbda3cd0a1b502669b32e773dc.tar.gz
fix(auth): the sign-up notice links the privacy statement, with a space
The link under the Register button was glued to the sentence before it: htm drops whitespace that holds a line break, so "deleted.Legal information". It also pointed at the hub's /legal/ index. Where an account is created is where GDPR art. 13 owes the person the information about their data, so it now links the privacy statement itself — /legal/confidentialite.fr.txt in French, /legal/privacy-statement.en.txt in every other language — on the hub that served the page, like every legal link. The sidebar's "Legal information" is unchanged. Checked in Chrome and Firefox (headless), in English and French. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests')
-rw-r--r--packages/meshbay-hub/tests/test_privacy_link.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_privacy_link.py b/packages/meshbay-hub/tests/test_privacy_link.py
new file mode 100644
index 0000000..f53c867
--- /dev/null
+++ b/packages/meshbay-hub/tests/test_privacy_link.py
@@ -0,0 +1,40 @@
+"""
+The sign-up form links the hub's privacy statement, the information GDPR
+art. 13 owes a person whose data is collected: the French text in French,
+the English one in every other language. On the hub that served the page,
+like every legal link (platform.legalUrl), never on a hub of somebody else's.
+"""
+
+import json
+import shutil
+import subprocess
+
+import pytest
+from spa_source import STATIC
+
+pytestmark = pytest.mark.skipif(shutil.which("node") is None, reason="no node")
+
+
+def test_each_language_links_its_statement():
+ probe = (
+ f"import({json.dumps((STATIC / 'platform.js').as_uri())}).then(p => "
+ "process.stdout.write(JSON.stringify(['fr', 'en', 'de', 'pt-BR']"
+ ".map(l => p.privacyUrl(l)))))"
+ )
+ out = subprocess.run(["node", "-e", probe], capture_output=True, text=True, check=True)
+ assert json.loads(out.stdout) == [
+ "/legal/confidentialite.fr.txt",
+ "/legal/privacy-statement.en.txt",
+ "/legal/privacy-statement.en.txt",
+ "/legal/privacy-statement.en.txt",
+ ]
+
+
+def test_the_sign_up_notice_links_it():
+ source = (STATIC / "auth-page.js").read_text(encoding="utf-8")
+ notice = source[source.index("${t('register.legal_notice')}"):]
+ notice = notice[:notice.index("</a>")]
+ assert "platform.privacyUrl(getLocale())" in notice
+ # htm drops whitespace that holds a line break: without it the link is
+ # glued to the sentence before it.
+ assert notice.startswith("${t('register.legal_notice')}${' '}")