]> Lady’s Gitweb - Etiquette/blobdiff - model.test.js
Add `::iriSpace` and use it in I·R·I handling
[Etiquette] / model.test.js
index 7190830c3a043dd200bfecf4ed7d68d924e6b32c..15a2f54cfa955831457a64d8dcd215e486937ed4 100644 (file)
@@ -186,8 +186,8 @@ describe("TagSystem", () => {
         );
       });
 
-      it("[[Call]] returns null if passed an invalid I·R·I", () => {
-        assertStrictEquals(Tag.fromIRI(`bad iri`), null);
+      it("[[Call]] throws if passed an invalid I·R·I", () => {
+        assertThrows(() => {Tag.fromIRI(`bad iri`)});
       });
     });
 
@@ -233,11 +233,11 @@ describe("TagSystem", () => {
 
       it("[[Call]] returns null if no tag with the given Tag U·R·I has been persisted", () => {
         assertStrictEquals(
-          Tag.fromIRI(`tag:${system.taggingEntity}:`),
+          Tag.fromTagURI(`tag:${system.taggingEntity}:`),
           null,
         );
         assertStrictEquals(
-          Tag.fromIRI(`tag:${system.taggingEntity}:000-0000`),
+          Tag.fromTagURI(`tag:${system.taggingEntity}:000-0000`),
           null,
         );
       });
@@ -763,6 +763,8 @@ describe("TagSystem", () => {
 
     // `::iri` is tested by a `.fromIRI`.
 
+    // `::iriSpace` is tested by a `.fromIRI`.
+
     // `::kind` is tested by the constructor.
 
     describe("::narrowerTags", () => {
@@ -1028,6 +1030,25 @@ describe("TagSystem", () => {
     });
   });
 
+  describe("::iriSpace", () => {
+    it("[[Get]] returns the I·R·I space", () => {
+      const system = new TagSystem("etaoin.example", "1972-12-31");
+      assertStrictEquals(
+        system.iriSpace,
+        "https://etaoin.example/tag:etaoin.example,1972-12-31:",
+      );
+      const system2 = new TagSystem(
+        "etaoin.example",
+        "1972-12-31",
+        "etaoin",
+      );
+      assertStrictEquals(
+        system2.iriSpace,
+        "https://etaoin.example/tag:etaoin.example,1972-12-31:",
+      );
+    });
+  });
+
   describe("::tagURI", () => {
     it("[[Get]] returns the Tag U·R·I", () => {
       const system = new TagSystem("etaoin.example", "1972-12-31");
This page took 0.058492 seconds and 4 git commands to generate.