Automatically parse URLs for team twitter + calendar event discord link

This commit is contained in:
Kalle
2023-11-11 13:15:54 +02:00
parent 9a126f543d
commit 4960464f55
5 changed files with 36 additions and 33 deletions

15
app/utils/string.test.ts Normal file
View File

@@ -0,0 +1,15 @@
import { suite } from "uvu";
import * as assert from "uvu/assert";
import { pathnameFromPotentialURL } from "./strings";
const PathnameFromPotentialURL = suite("pathnameFromPotentialURL()");
PathnameFromPotentialURL("Resolves path name from valid URL", () => {
assert.is(pathnameFromPotentialURL("https://twitter.com/sendouc"), "sendouc");
});
PathnameFromPotentialURL("Returns string as is if not URL", () => {
assert.is(pathnameFromPotentialURL("sendouc"), "sendouc");
});
PathnameFromPotentialURL.run();