16 lines
812 B
TypeScript
16 lines
812 B
TypeScript
import "../setup.ts";
|
|
import { assert, assertFalse } from "@std/assert";
|
|
import { isSelfUrl } from "../../lib/self-url.ts";
|
|
|
|
Deno.test("isSelfUrl: this site's dump, user and playlist pages only", () => {
|
|
// GERBEUR_PUBLIC_URL is http://gerbeur.test in the suite.
|
|
assert(isSelfUrl(new URL("http://gerbeur.test/@bob/dumps/abc")));
|
|
assert(isSelfUrl(new URL("https://GERBEUR.test/@bob")));
|
|
assert(isSelfUrl(new URL("http://gerbeur.test/@bob/playlists")));
|
|
assert(isSelfUrl(new URL("http://gerbeur.test/@bob/playlists/p-1")));
|
|
assertFalse(isSelfUrl(new URL("http://gerbeur.test/@bob/dumps/abc/edit")));
|
|
assertFalse(isSelfUrl(new URL("http://gerbeur.test/search")));
|
|
assertFalse(isSelfUrl(new URL("http://gerbeur.test/dumps/abc")));
|
|
assertFalse(isSelfUrl(new URL("http://elsewhere.test/@bob")));
|
|
});
|