+describe("isIRISuffix", () => {
+ it("[[Call]] identifies I·R·I suffixes", () => {
+ for (
+ const [iri, { authority, path }] of Object.entries(
+ exampleReferences,
+ )
+ ) {
+ if (!authority) {
+ continue;
+ } else {
+ assertStrictEquals(
+ isIRISuffix(authority + path),
+ iri in exampleIRIReferences,
+ path,
+ );
+ }
+ }
+ });
+});
+
+describe("isLEIRI", () => {
+ it("[[Call]] identifies L·E·I·R·Is", () => {
+ for (
+ const [leiri, { scheme }] of Object.entries(exampleReferences)
+ ) {
+ assertStrictEquals(
+ isLEIRI(leiri),
+ leiri in exampleLEIRIReferences && scheme != null,
+ leiri,
+ );
+ }
+ });
+});
+
+describe("isLEIRIPath", () => {
+ it("[[Call]] identifies L·E·I·R·I paths", () => {
+ for (
+ const [leiri, { path }] of Object.entries(exampleReferences)
+ ) {
+ if (path === "") {
+ continue;
+ } else {
+ assertStrictEquals(
+ isLEIRIPath(path ?? leiri),
+ leiri in exampleLEIRIReferences,
+ path,
+ );
+ }
+ }
+ });
+});
+
+describe("isLEIRIReference", () => {
+ it("[[Call]] identifies L·E·I·R·I references", () => {
+ for (const leiri of Object.keys(exampleReferences)) {
+ assertStrictEquals(
+ isLEIRIReference(leiri),
+ leiri in exampleLEIRIReferences,
+ leiri,
+ );
+ }
+ });
+});
+
+describe("isLEIRISuffix", () => {
+ it("[[Call]] identifies L·E·I·R·I suffixes", () => {
+ for (
+ const [leiri, { authority, path }] of Object.entries(
+ exampleReferences,
+ )
+ ) {
+ if (!authority) {
+ continue;
+ } else {
+ assertStrictEquals(
+ isLEIRISuffix(authority + path),
+ leiri in exampleLEIRIReferences,
+ path,
+ );
+ }
+ }
+ });
+});
+
+describe("isURI", () => {
+ it("[[Call]] identifies U·R·Is", () => {
+ for (
+ const [uri, { scheme }] of Object.entries(exampleReferences)
+ ) {
+ assertStrictEquals(
+ isURI(uri),
+ uri in exampleURIReferences && scheme != null,
+ uri,
+ );
+ }
+ });
+});
+
+describe("isURIPath", () => {
+ it("[[Call]] identifies U·R·I paths", () => {
+ for (const [uri, { path }] of Object.entries(exampleReferences)) {
+ if (path === "") {
+ continue;
+ } else {
+ assertStrictEquals(
+ isURIPath(path ?? uri),
+ uri in exampleURIReferences,
+ path,
+ );
+ }
+ }
+ });
+});
+
+describe("isURIReference", () => {
+ it("[[Call]] identifies U·R·I references", () => {
+ for (const uri of Object.keys(exampleReferences)) {
+ assertStrictEquals(
+ isURIReference(uri),
+ uri in exampleURIReferences,
+ uri,
+ );
+ }
+ });
+});
+
+describe("isURISuffix", () => {
+ it("[[Call]] identifies U·R·I suffixes", () => {
+ for (
+ const [uri, { authority, path }] of Object.entries(
+ exampleReferences,
+ )
+ ) {
+ if (!authority) {
+ continue;
+ } else {
+ assertStrictEquals(
+ isURISuffix(authority + path),
+ uri in exampleURIReferences,
+ path,
+ );
+ }
+ }
+ });
+});
+
+describe("mergePaths", () => {
+ it("[[Call]] handles the case of an empty base path", () => {
+ assertStrictEquals(
+ mergePaths("", "etaoin"),
+ "/etaoin",
+ );
+ });
+
+ it("[[Call]] handles the case of a non·empty base path", () => {
+ assertStrictEquals(
+ mergePaths("/etaoin/cmfwyp", "shrdlu"),
+ "/etaoin/shrdlu",
+ );
+ });
+});
+
+describe("parseReference", () => {
+ it("[[Call]] correctly parses references", () => {
+ for (const [iri, value] of Object.entries(exampleReferences)) {