mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-18 15:45:03 +00:00
Fix URL matching in automod, censor, and spam plugin
This commit is contained in:
parent
94f8362f43
commit
d07a72ce2a
3 changed files with 23 additions and 1 deletions
21
backend/src/utils.test.ts
Normal file
21
backend/src/utils.test.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { getUrlsInString } from "./utils";
|
||||
|
||||
import test from "ava";
|
||||
|
||||
test("Detects full links", t => {
|
||||
const urls = getUrlsInString("foo https://google.com/ bar");
|
||||
t.is(urls.length, 1);
|
||||
t.is(urls[0].hostname, "google.com");
|
||||
});
|
||||
|
||||
test("Detects partial links", t => {
|
||||
const urls = getUrlsInString("foo google.com bar");
|
||||
t.is(urls.length, 1);
|
||||
t.is(urls[0].hostname, "google.com");
|
||||
});
|
||||
|
||||
test("Detects subdomains", t => {
|
||||
const urls = getUrlsInString("foo photos.google.com bar");
|
||||
t.is(urls.length, 1);
|
||||
t.is(urls[0].hostname, "photos.google.com");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue