// Share links (node --test test/). import { test } from 'node:test' import assert from 'node:assert/strict' import { blueskyURL, graphemes, linkedinURL, mastodonHost, mastodonURL, shareText } from '../src/share.ts' test('the post text is title, summary and link', () => { assert.equal(shareText(' Spring opening ', '', 'https://example.org/news/spring/'), 'Spring opening\n\nhttps://example.org/news/spring/') assert.equal(shareText('A', 'B', 'https://x.org/'), 'A\n\nB\n\nhttps://x.org/') }) test('a Mastodon server can be typed any usual way', () => { for (const s of ['linuxexpert.org', 'https://linuxexpert.org/', '@john@linuxexpert.org', 'LinuxExpert.org/@john']) { assert.equal(mastodonHost(s), 'linuxexpert.org', s) } for (const s of ['', 'not a host', 'javascript:alert(1)', 'evil.org">