branch: elpa/mastodon
commit ffe6c2096033cb6bcc71c137abef97708e5f84ee
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>
add mastodon-tests.el, tests for fedi-url-p
---
test/mastodon-tests.el | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/test/mastodon-tests.el b/test/mastodon-tests.el
new file mode 100644
index 0000000000..3d6dcca01a
--- /dev/null
+++ b/test/mastodon-tests.el
@@ -0,0 +1,70 @@
+;;; mastodon-test.el --- Tests for mastodon.el -*- lexical-binding: nil -*-
+
+(ert-deftest mastodon-fedi-url-p ()
+ ;; TODO: /objects, /display, /profile, /p, /u, /comment
+ (should
+ ;; User handle:
+ (mastodon--fedi-url-p
+ "https://misskey.noellabo.jp/@shigeru"))
+ (should
+ ;; User post:
+ (mastodon--fedi-url-p
+ "https://todon.nl/@admin/117134394057436440"))
+ (should
+ ;; tag:
+ (mastodon--fedi-url-p
+ "https://todon.nl/tags/nobot"))
+ (should
+ ;; we match such handles, but not with crazy codes and multi slashes
+ ;; after them, so we went with URI, below (poss stupid):
+ ;; Flipboard URL:
+ (not
+ (mastodon--fedi-url-p
+
"https://flipboard.com/@gizmodo/tech-fknh6odjz/-/a-UQ_TmLCbShiYB55LrrrzWQ%3Aa%3A1876139665-%2F0")))
+ (should
+ ;; Flipboard URI:
+ (mastodon--fedi-url-p
+
"https://flipboard.com/users/Gizmodo/statuses/UQ_TmLCbShiYB55LrrrzWQ:a:1876139665"))
+ (should
+ ;; pleroma user
+ (mastodon--fedi-url-p
+ "https://udongein.xyz/users/duponin"))
+ (should
+ ;; pleroma post
+ (mastodon--fedi-url-p
+ "https://udongein.xyz/notice/AcsRkbQxDJbO6T8hbE"))
+ (should
+ ;; Akkoma post:
+ (mastodon--fedi-url-p
+ "https://fe.disroot.org/@muppeth/posts/BBD5a3BRt4d2RTDQdU"))
+ (should
+ ;; Lemmy post:
+ (not (mastodon--fedi-url-p
+ "https://lemmy.ml/post/53786458")))
+ (should
+ ;; Lemmy comment:
+ (not (mastodon--fedi-url-p
+ "https://lemmy.ml/post/53786458/28261605")))
+ (should
+ ;; Misskey post:
+ (mastodon--fedi-url-p
+ "https://misskey.noellabo.jp/notes/as5y0n7y98"))
+ (should
+ ;; gts post
+ (mastodon--fedi-url-p
+ "https://aseachange.com/@elena/statuses/01KXDSRTC2KYZ9VSGB219EXPKP"))
+ (should
+ ;; peertube post (should this not be external?)
+ (mastodon--fedi-url-p
+ "https://peertube.tv/w/ej3Ye8C4ZQcFyPZLev4x93"))
+ (should
+ ;; peertube channel (should this not be external?)
+ (mastodon--fedi-url-p
+ "https://peertube.tv/c/transport_evolved"))
+ (should
+ ;; collection
+ (mastodon--fedi-url-p
+ "https://todon.nl/collections/116879312823651190"))
+ ;; TODO: Fed.brid.gy:
+
+ )