leaflet.pub astro loader
1import { expect, test } from "vitest";
2import { uriToRkey } from "../lib/utils";
3
4test("should throw if invalid at uri is passed in", () => {
5 expect(() => uriToRkey("test")).toThrowError("get rkey");
6});
7
8test("should pass if valid at uri is passed in", () => {
9 expect(
10 uriToRkey(
11 "at://did:plc:qttsv4e7pu2jl3ilanfgc3zn/pub.leaflet.document/3lvl7m6jd4s2e",
12 ),
13 ).toBe("3lvl7m6jd4s2e");
14});
15
16test("should not pass if invalid uri is passed in", () => {
17 expect(() => uriToRkey("invalid")).toThrowError(/failed to get rkey/i);
18});