]>
Lady’s Gitweb - Etiquette/blob - model.test.js
15a2f54cfa955831457a64d8dcd215e486937ed4
1 // 📧🏷️ Étiquette ∷ model.test.js
2 // ====================================================================
4 // Copyright © 2023 Lady [@ Lady’s Computer].
6 // This Source Code Form is subject to the terms of the Mozilla Public
7 // License, v. 2.0. If a copy of the MPL was not distributed with this
8 // file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
21 } from "./dev-deps.js";
22 import { TagSystem
} from "./model.js";
24 describe("TagSystem", () => {
25 it("[[Call]] throws", () => {
31 it("[[Construct]] creates a new TagSystem", () => {
33 Object
.getPrototypeOf(new TagSystem("example", "1972-12-31")),
38 it("[[Construct]] uses the identifier if provided", () => {
40 new TagSystem("example", "1972-12-31", "etaoin").identifier
,
45 it("[[Construct]] uses an empty identifier if none is provided", () => {
47 new TagSystem("example", "1972-12-31").identifier
,
52 it("[[Construct]] throws if provided an invalid domain", () => {
54 new TagSystem("example@example", "1972-12-31");
57 new TagSystem("0.0.0.0", "1972-12-31");
61 it("[[Construct]] throws if provided an invalid date", () => {
63 new TagSystem("example", "1969");
66 new TagSystem("example", "1972-12-31T00:00:00Z");
70 describe("::Tag", () => {
75 system
= new TagSystem("example", "1972-12-31");
79 it("[[Get]] returns the same value every time", () => {
80 assertStrictEquals(Tag
, system
.Tag
);
83 it("[[Call]] throws", () => {
89 it("[[Construct]] returns a new Tag", () => {
91 Object
.getPrototypeOf(new Tag()),
96 it('[[Construct]] defaults the kind to "Tag"', () => {
97 assertStrictEquals(new Tag().kind
, "Tag");
100 it("[[Construct]] correctly sets the tag kind", () => {
102 new Tag("RelationshipTag").kind
,
107 it("[[Construct]] defaults the preferred label to the empty string", () => {
108 assertStrictEquals(new Tag().prefLabel
, "");
111 it("[[Construct]] correctly sets the preferred label to a simple string", () => {
113 new Tag("RelationshipTag", "Shadow, Me").prefLabel
,
118 it("[[Construct]] initializes tag identifiers to null", () => {
120 new Tag().identifier
,
125 it("[[Construct]] correctly sets the preferred label to a language‐tagged string", () => {
128 ...new Tag("RelationshipTag", {
129 "@value": "Shadow, Me",
133 { "@value": "Shadow, Me", "@language": "en" },
137 it("[[Construct]] throws if the tag kind is not recognized", () => {
143 describe(".all", () => {
144 it("[[Call]] yields all the persisted tags", () => {
145 const tags
= new Set(function* () {
148 // Generate 5 tags and remember their identifiers.
149 const tag
= new Tag();
151 yield tag
.identifier
;
154 for (const tag
of Tag
.all()) {
156 Object
.getPrototypeOf(tag
),
161 new Set(Array
.from(Tag
.all(), (tag
) => tag
.identifier
)),
167 describe(".fromIRI", () => {
168 it("[[Call]] returns the persisted tag with the given I·R·I", () => {
169 const tag
= new Tag();
171 const { identifier
, iri
} = tag
;
172 const retrieved
= Tag
.fromIRI(iri
);
174 Object
.getPrototypeOf(retrieved
),
177 assertStrictEquals(retrieved
.identifier
, identifier
);
180 it("[[Call]] returns null if no tag with the given I·R·I has been persisted", () => {
183 `https://${system.authorityName}/tag:${system.taggingEntity}:000-0000`,
189 it("[[Call]] throws if passed an invalid I·R·I", () => {
190 assertThrows(() => {Tag
.fromIRI(`bad iri`)});
194 describe(".fromIdentifier", () => {
195 it("[[Call]] returns the persisted tag with the given identifier", () => {
196 const tag
= new Tag();
198 const { identifier
} = tag
;
199 const retrieved
= Tag
.fromIdentifier(identifier
);
201 Object
.getPrototypeOf(retrieved
),
204 assertStrictEquals(retrieved
.identifier
, identifier
);
207 it("[[Call]] returns null if no tag with the given identifier has been persisted", () => {
208 assertStrictEquals(Tag
.fromIdentifier("000-0000"), null);
211 it("[[Call]] throws if passed an invalid identifier", () => {
213 Tag
.fromIdentifier(""); // wrong format
216 Tag
.fromIdentifier("100-0000"); // bad checksum
221 describe(".fromTagURI", () => {
222 it("[[Call]] returns the persisted tag with the given Tag U·R·I", () => {
223 const tag
= new Tag();
225 const { identifier
, tagURI
} = tag
;
226 const retrieved
= Tag
.fromTagURI(tagURI
);
228 Object
.getPrototypeOf(retrieved
),
231 assertStrictEquals(retrieved
.identifier
, identifier
);
234 it("[[Call]] returns null if no tag with the given Tag U·R·I has been persisted", () => {
236 Tag
.fromTagURI(`tag:${system.taggingEntity}:`),
240 Tag
.fromTagURI(`tag:${system.taggingEntity}:000-0000`),
245 it("[[Call]] throws if passed an invalid Tag U·R·I", () => {
247 Tag
.fromTagURI(""); // wrong format
251 "tag:unexample,1970-01-01:Z", // incorrect tagging entity
257 describe(".getSystem", () => {
258 it("[[Has]] is not present", () => {
259 assertFalse("getSystem" in Tag
);
263 describe(".identifiers", () => {
264 it("[[Call]] yields all the persisted identifiers", () => {
265 const tags
= new Set(function* () {
268 // Generate 5 tags and remember their identifiers.
269 const tag
= new Tag();
271 yield tag
.identifier
;
275 new Set(Tag
.identifiers()),
281 // `.[Storage.toInstance]` is tested by `.fromIdentifier`.
283 describe("::addAltLabel", () => {
284 it("[[Call]] does nothing if called with no arguments", () => {
285 const tag
= new Tag();
287 assertEquals([...tag
.altLabels()], []);
290 it("[[Call]] adds the provided alternative labels", () => {
291 const tag
= new Tag();
295 { "@value": "three", "@language": "en" },
300 ($) => typeof $ == "string" ? $ : { ...$ },
305 { "@value": "three", "@language": "en" },
310 it("[[Call]] returns this", () => {
311 const tag
= new Tag();
312 assertStrictEquals(tag
.addAltLabel(), tag
);
316 describe("::addBroaderTag", () => {
317 it("[[Call]] does nothing if called with no arguments", () => {
318 const tag
= new Tag();
320 assertEquals([...tag
.broaderTags()], []);
323 it("[[Call]] adds the provided broader tags", () => {
324 const broader
= new Tag();
326 const broader2
= new Tag();
328 const tag
= new Tag();
329 tag
.addBroaderTag(broader
, broader2
);
331 Array
.from(tag
.broaderTags(), ($) => $.identifier
),
332 [broader
.identifier
, broader2
.identifier
],
336 it("[[Call]] returns this", () => {
337 const tag
= new Tag();
338 assertStrictEquals(tag
.addBroaderTag(), tag
);
341 it("[[Call]] throws when adding a non‐persisted tag", () => {
342 const tag
= new Tag();
344 tag
.addBroaderTag(new Tag());
348 it("[[Call]] throws when adding an unrecognized identifier", () => {
349 const tag
= new Tag();
351 tag
.addBroaderTag("000-0000"); // not persisted
354 tag
.addBroaderTag(""); // bad format
359 describe("::addHiddenLabel", () => {
360 it("[[Call]] does nothing if called with no arguments", () => {
361 const tag
= new Tag();
362 tag
.addHiddenLabel();
363 assertEquals([...tag
.hiddenLabels()], []);
366 it("[[Call]] adds the provided hidden labels", () => {
367 const tag
= new Tag();
371 { "@value": "three", "@language": "en" },
376 ($) => typeof $ == "string" ? $ : { ...$ },
381 { "@value": "three", "@language": "en" },
386 it("[[Call]] returns this", () => {
387 const tag
= new Tag();
388 assertStrictEquals(tag
.addHiddenLabel(), tag
);
392 describe("::addInCanonTag", () => {
393 it("[[Call]] does nothing if called with no arguments", () => {
394 const tag
= new Tag("EntityTag");
396 assertEquals([...tag
.inCanonTags()], []);
399 it("[[Call]] adds the provided canon tags", () => {
400 const canon
= new Tag("CanonTag");
402 const canon2
= new Tag("CanonTag");
404 const tag
= new Tag("EntityTag");
405 tag
.addInCanonTag(canon
, canon2
);
407 Array
.from(tag
.inCanonTags(), ($) => $.identifier
),
408 [canon
.identifier
, canon2
.identifier
],
412 it("[[Call]] returns this", () => {
413 const tag
= new Tag("EntityTag");
414 assertStrictEquals(tag
.addInCanonTag(), tag
);
417 it("[[Call]] throws when this is not a tag which can be placed in canon", () => {
419 new Tag().addInCanonTag();
423 it("[[Call]] throws when provided with a non‐canon tag", () => {
424 const notCanon
= new Tag();
426 const tag
= new Tag("EntityTag");
428 tag
.addInCanonTag(notCanon
);
432 it("[[Call]] throws when adding a non‐persisted tag", () => {
433 const tag
= new Tag("EntityTag");
435 tag
.addInCanonTag(new Tag("CanonTag"));
439 it("[[Call]] throws when adding an unrecognized identifier", () => {
440 const tag
= new Tag("EntityTag");
442 tag
.addInCanonTag("000-0000"); // not persisted
445 tag
.addInCanonTag(""); // bad format
450 describe("::addInvolvesTag", () => {
451 it("[[Call]] does nothing if called with no arguments", () => {
452 const tag
= new Tag("ConceptualTag");
453 tag
.addInvolvesTag();
454 assertEquals([...tag
.involvesTags()], []);
457 it("[[Call]] adds the provided tags", () => {
458 const involved
= new Tag();
460 const involved2
= new Tag();
462 const tag
= new Tag("ConceptualTag");
463 tag
.addInvolvesTag(involved
, involved2
);
465 Array
.from(tag
.involvesTags(), ($) => $.identifier
),
466 [involved
.identifier
, involved2
.identifier
],
470 it("[[Call]] returns this", () => {
471 const tag
= new Tag("ConceptualTag");
472 assertStrictEquals(tag
.addInvolvesTag(), tag
);
475 it("[[Call]] throws when this is not a conceptual tag", () => {
477 new Tag().addInvolvesTag();
481 it("[[Call]] throws when this is a relationship tag and provided with a non‐involvable tag", () => {
482 const notInvolved
= new Tag();
483 notInvolved
.persist();
484 const tag
= new Tag("RelationshipTag");
486 tag
.addInvolvesTag(notInvolved
);
490 it("[[Call]] throws when adding a non‐persisted tag", () => {
491 const tag
= new Tag("ConceptualTag");
493 tag
.addInvolvesTag(new Tag());
497 it("[[Call]] throws when adding an unrecognized identifier", () => {
498 const tag
= new Tag("ConceptualTag");
500 tag
.addInvolvesTag("000-0000"); // not persisted
503 tag
.addInvolvesTag(""); // bad format
508 // `::altLabels` is tested by `::addAltLabel`.
510 describe("::authorityName", () => {
511 it("[[Get]] returns the authority name of the tag system", () => {
513 new Tag().authorityName
,
514 system
.authorityName
,
519 // `::broaderTags` is tested by `::addBroaderTag`.
521 describe("::broaderTransitiveTags", () => {
522 it("[[Call]] returns broader tags transitively", () => {
523 const superBroad
= new Tag();
524 superBroad
.persist();
525 const broad
= new Tag();
526 broad
.addBroaderTag(superBroad
);
528 const tag
= new Tag();
529 tag
.addBroaderTag(broad
);
531 Array
.from(tag
.broaderTransitiveTags(), ($) => $.identifier
),
532 [broad
.identifier
, superBroad
.identifier
],
536 it("[[Call]] cannot recurse infinitely", () => {
537 const tag
= new Tag();
539 const broad
= new Tag();
540 broad
.addBroaderTag(tag
);
542 tag
.addBroaderTag(broad
);
545 Array
.from(tag
.broaderTransitiveTags(), ($) => $.identifier
),
546 [broad
.identifier
, tag
.identifier
],
551 describe("::deleteAltLabel", () => {
552 it("[[Call]] does nothing if called with no arguments", () => {
553 const tag
= new Tag();
554 tag
.addAltLabel("etaoin");
555 tag
.deleteAltLabel();
556 assertEquals([...tag
.altLabels()], ["etaoin"]);
559 it("[[Call]] deletes only the provided hidden labels", () => {
560 const tag
= new Tag();
564 { "@value": "three", "@language": "en" },
570 { "@value": "three", "@language": "en" },
571 { "@value": "four", "@language": "en" },
573 assertEquals([...tag
.altLabels()], ["four"]);
576 it("[[Call]] returns this", () => {
577 const tag
= new Tag();
578 assertStrictEquals(tag
.deleteAltLabel(), tag
);
582 describe("::deleteBroaderTag", () => {
583 it("[[Call]] does nothing if called with no arguments", () => {
584 const broader
= new Tag();
586 const tag
= new Tag();
587 tag
.addBroaderTag(broader
);
588 tag
.deleteBroaderTag();
590 Array
.from(tag
.broaderTags(), ($) => $.identifier
),
591 [broader
.identifier
],
595 it("[[Call]] deletes only the provided broader tags", () => {
596 const superBroader
= new Tag();
597 superBroader
.persist();
598 const broader
= new Tag();
599 broader
.addBroaderTag(superBroader
);
601 const broader2
= new Tag();
602 broader2
.addBroaderTag(superBroader
);
604 const tag
= new Tag();
605 tag
.addBroaderTag(broader
, broader2
);
606 tag
.deleteBroaderTag(broader
, superBroader
, "000-0000", "");
608 Array
.from(tag
.broaderTags(), ($) => $.identifier
),
609 [broader2
.identifier
],
613 it("[[Call]] returns this", () => {
614 const tag
= new Tag();
615 assertStrictEquals(tag
.deleteBroaderTag(), tag
);
619 describe("::deleteHiddenLabel", () => {
620 it("[[Call]] does nothing if called with no arguments", () => {
621 const tag
= new Tag();
622 tag
.addHiddenLabel("etaoin");
623 tag
.deleteHiddenLabel();
624 assertEquals([...tag
.hiddenLabels()], ["etaoin"]);
627 it("[[Call]] deletes only the provided alternative labels", () => {
628 const tag
= new Tag();
632 { "@value": "three", "@language": "en" },
635 tag
.deleteHiddenLabel(
638 { "@value": "three", "@language": "en" },
639 { "@value": "four", "@language": "en" },
641 assertEquals([...tag
.hiddenLabels()], ["four"]);
644 it("[[Call]] returns this", () => {
645 const tag
= new Tag();
646 assertStrictEquals(tag
.deleteHiddenLabel(), tag
);
650 describe("::deleteInCanonTag", () => {
651 it("[[Call]] does nothing if called with no arguments", () => {
652 const canon
= new Tag("CanonTag");
654 const tag
= new Tag("EntityTag");
655 tag
.addInCanonTag(canon
);
656 tag
.deleteInCanonTag();
658 Array
.from(tag
.inCanonTags(), ($) => $.identifier
),
663 it("[[Call]] deletes only the provided canon tags", () => {
664 const canon
= new Tag("CanonTag");
666 const canon2
= new Tag("CanonTag");
668 const tag
= new Tag("EntityTag");
669 tag
.addInCanonTag(canon
, canon2
);
670 tag
.deleteInCanonTag(canon
, "000-0000", "");
672 Array
.from(tag
.inCanonTags(), ($) => $.identifier
),
677 it("[[Call]] returns this", () => {
678 const tag
= new Tag("EntityTag");
679 assertStrictEquals(tag
.deleteInCanonTag(), tag
);
683 describe("::deleteInvolvesTag", () => {
684 it("[[Call]] does nothing if called with no arguments", () => {
685 const involved
= new Tag();
687 const tag
= new Tag("ConceptualTag");
688 tag
.addInvolvesTag(involved
);
689 tag
.deleteInvolvesTag();
691 Array
.from(tag
.involvesTags(), ($) => $.identifier
),
692 [involved
.identifier
],
696 it("[[Call]] deletes only the provided involved tags", () => {
697 const character
= new Tag("CharacterTag");
699 const involved
= new Tag("RelationshipTag");
700 involved
.addInvolvesTag(character
);
702 const involved2
= new Tag("RelationshipTag");
703 involved2
.addInvolvesTag(character
);
705 const tag
= new Tag("RelationshipTag");
706 tag
.addInvolvesTag(involved
, involved2
);
707 tag
.deleteInvolvesTag(involved
, character
, "000-0000", "");
709 Array
.from(tag
.involvesTags(), ($) => $.identifier
),
710 [involved2
.identifier
],
714 it("[[Call]] returns this", () => {
715 const tag
= new Tag("ConceptualTag");
716 assertStrictEquals(tag
.deleteInvolvesTag(), tag
);
720 describe("::hasInCanonTags", () => {
721 it("[[Call]] yields the persisted tags which have this tag in canon", () => {
722 const canon
= new Tag("CanonTag");
724 const entity
= new Tag("EntityTag");
725 entity
.addInCanonTag(canon
);
727 const entity2
= new Tag("EntityTag");
728 entity2
.addInCanonTag(canon
);
730 const tag
= Tag
.fromIdentifier(canon
.identifier
); // reload
732 Array
.from(tag
.hasInCanonTags(), ($) => $.identifier
),
733 [entity
.identifier
, entity2
.identifier
],
738 // `::hiddenLabels` is tested by `::addHiddenLabel`.
740 // `::identifier` is tested by a `.fromIdentifier`.
742 // `::inCanonTags` is tested by `::addInCanonTag`.
744 describe("::involvedInTags", () => {
745 it("[[Call]] yields the persisted tags which involve this tag", () => {
746 const involved
= new Tag();
748 const conceptual
= new Tag("ConceptualTag");
749 conceptual
.addInvolvesTag(involved
);
750 conceptual
.persist();
751 const conceptual2
= new Tag("ConceptualTag");
752 conceptual2
.addInvolvesTag(involved
);
753 conceptual2
.persist();
754 const tag
= Tag
.fromIdentifier(involved
.identifier
); // reload
756 Array
.from(tag
.involvedInTags(), ($) => $.identifier
),
757 [conceptual
.identifier
, conceptual2
.identifier
],
762 // `::involvesTags` is tested by `::addInvolvesTag`.
764 // `::iri` is tested by a `.fromIRI`.
766 // `::iriSpace` is tested by a `.fromIRI`.
768 // `::kind` is tested by the constructor.
770 describe("::narrowerTags", () => {
771 it("[[Call]] yields the persisted tags which are narrower than this tag", () => {
772 const broader
= new Tag();
774 const narrower
= new Tag();
775 narrower
.addBroaderTag(broader
);
777 const narrower2
= new Tag();
778 narrower2
.addBroaderTag(broader
);
780 const tag
= Tag
.fromIdentifier(broader
.identifier
); // reload
782 Array
.from(tag
.narrowerTags(), ($) => $.identifier
),
783 [narrower
.identifier
, narrower2
.identifier
],
788 describe("::narrowerTransitiveTags", () => {
789 it("[[Call]] returns narrower tags transitively", () => {
790 const broad
= new Tag();
792 const narrow
= new Tag();
793 narrow
.addBroaderTag(broad
);
795 const superNarrow
= new Tag();
796 superNarrow
.addBroaderTag(narrow
);
797 superNarrow
.persist();
798 const tag
= Tag
.fromIdentifier(broad
.identifier
); // reload
801 tag
.narrowerTransitiveTags(),
804 [narrow
.identifier
, superNarrow
.identifier
],
808 it("[[Call]] cannot recurse infinitely", () => {
809 const tag
= new Tag();
811 const broad
= new Tag();
812 broad
.addBroaderTag(tag
);
814 tag
.addBroaderTag(broad
);
817 Array
.from(tag
.broaderTransitiveTags(), ($) => $.identifier
),
818 [broad
.identifier
, tag
.identifier
],
823 describe("::persist", () => {
824 it("[[Call]] returns an object with expected properties if there were changes", () => {
825 const tag
= new Tag();
826 const activity
= tag
.persist();
831 "https://ns.1024.gdn/Tagging/discovery.context.jsonld",
836 assertArrayIncludes(activity
["@type"], ["TagActivity"]);
837 assert("endTime" in activity
);
840 it("[[Call]] returns a Create activity with a type predicate for new objects", () => {
841 const activity
= new Tag().persist();
842 assertEquals(activity
["@type"], ["TagActivity", "Create"]);
843 assertArrayIncludes(activity
.states
, [{
849 it("[[Call]] returns an Update activity for old objects", () => {
850 const tag
= new Tag();
852 tag
.prefLabel
= "etaoin";
853 const activity
= tag
.persist();
854 assertEquals(activity
["@type"], ["TagActivity", "Update"]);
857 it("[[Call]] states and unstates changes", () => {
858 const broader1
= new Tag();
860 const broader2
= new Tag();
862 const tag
= new Tag();
863 tag
.addBroaderTag(broader1
);
865 tag
.prefLabel
= "etaoin";
866 tag
.deleteBroaderTag(broader1
);
867 tag
.addBroaderTag(broader2
);
868 const activity
= tag
.persist();
869 assertObjectMatch(activity
, {
871 { predicate
: "prefLabel", object
: { "@value": "" } },
872 { predicate
: "broader", object
: broader1
.iri
},
875 { predicate
: "prefLabel", object
: { "@value": "etaoin" } },
876 { predicate
: "broader", object
: broader2
.iri
},
881 it("[[Call]] doesn’t state if there are no additions", () => {
882 const tag
= new Tag();
883 tag
.addAltLabel("etaoin");
885 tag
.deleteAltLabel("etaoin");
886 const activity
= tag
.persist();
887 assertFalse("state" in activity
);
890 it("[[Call]] doesn’t unstate if there are no removals", () => {
891 const tag
= new Tag();
893 tag
.addAltLabel("etaoin");
894 const activity
= tag
.persist();
895 assertFalse("unstate" in activity
);
898 it("[[Call]] returns null if no meaningful changes were made", () => {
899 const tag
= new Tag();
901 const activity
= tag
.persist();
902 assertStrictEquals(activity
, null);
905 it("[[Call]] returns undefined for a silent persist", () => {
906 const broader
= new Tag();
908 const tag
= new Tag();
909 tag
.prefLabel
= "etaoin";
910 tag
.addBroaderTag(broader
);
911 assertStrictEquals(tag
.persist(true), undefined);
915 describe("::prefLabel", () => {
916 it("[[Set]] sets the preferred label", () => {
917 const tag
= new Tag();
918 tag
.prefLabel
= "one";
919 assertStrictEquals(tag
.prefLabel
, "one");
920 tag
.prefLabel
= { "@value": "two" };
921 assertStrictEquals(tag
.prefLabel
, "two");
922 tag
.prefLabel
= { "@value": "three", "@language": "en" };
924 { ...tag
.prefLabel
},
925 { "@value": "three", "@language": "en" },
930 // `::tagURI` is tested by a `.fromTagURI`.
932 describe("::taggingEntity", () => {
933 it("[[Get]] returns the tagging entity of the tag system", () => {
935 new Tag().taggingEntity
,
936 system
.taggingEntity
,
941 describe("::toString", () => {
942 it("[[Get]] returns the string value of the preferred label", () => {
943 const tag
= new Tag();
944 tag
.prefLabel
= { "@value": "etaoin", "@language": "zxx" };
945 assertStrictEquals(tag
.toString(), "etaoin");
949 // `::[Storage.toObject]` is tested by `::persist`.
952 describe("::authorityName", () => {
953 it("[[Get]] returns the authority name", () => {
954 const system
= new TagSystem("etaoin.example", "1972-12-31");
955 assertStrictEquals(system
.authorityName
, "etaoin.example");
959 describe("::authorityName", () => {
960 it("[[Get]] returns the date", () => {
961 const system
= new TagSystem("etaoin.example", "1972-12-31");
962 assertStrictEquals(system
.date
, "1972-12-31");
966 describe("::identifiers", () => {
967 it("[[Get]] yields the extant entities", () => {
968 const system
= new TagSystem("etaoin.example", "1972-12-31");
969 const tags
= new Set(function* () {
972 // Generate 5 tags and remember their identifiers.
973 const tag
= new system
.Tag();
975 yield tag
.identifier
;
979 new Set(Array
.from(system
.entities(), ($) => $.identifier
)),
985 describe("::identifier", () => {
986 it("[[Get]] returns the identifier", () => {
987 const system
= new TagSystem("etaoin.example", "1972-12-31");
988 assertStrictEquals(system
.identifier
, "");
989 const system2
= new TagSystem(
994 assertStrictEquals(system2
.identifier
, "etaoin");
998 describe("::identifiers", () => {
999 it("[[Get]] yields the identifiers in use", () => {
1000 const system
= new TagSystem("etaoin.example", "1972-12-31");
1001 const tags
= new Set(function* () {
1004 // Generate 5 tags and remember their identifiers.
1005 const tag
= new system
.Tag();
1007 yield tag
.identifier
;
1010 assertEquals(new Set(system
.identifiers()), tags
);
1014 describe("::iri", () => {
1015 it("[[Get]] returns the I·R·I", () => {
1016 const system
= new TagSystem("etaoin.example", "1972-12-31");
1019 "https://etaoin.example/tag:etaoin.example,1972-12-31:",
1021 const system2
= new TagSystem(
1028 "https://etaoin.example/tag:etaoin.example,1972-12-31:etaoin",
1033 describe("::iriSpace", () => {
1034 it("[[Get]] returns the I·R·I space", () => {
1035 const system
= new TagSystem("etaoin.example", "1972-12-31");
1038 "https://etaoin.example/tag:etaoin.example,1972-12-31:",
1040 const system2
= new TagSystem(
1047 "https://etaoin.example/tag:etaoin.example,1972-12-31:",
1052 describe("::tagURI", () => {
1053 it("[[Get]] returns the Tag U·R·I", () => {
1054 const system
= new TagSystem("etaoin.example", "1972-12-31");
1057 "tag:etaoin.example,1972-12-31:",
1059 const system2
= new TagSystem(
1066 "tag:etaoin.example,1972-12-31:etaoin",
1071 describe("::taggingEntity", () => {
1072 it("[[Get]] returns the tagging entity", () => {
1073 const system
= new TagSystem("etaoin.example", "1972-12-31");
1075 system
.taggingEntity
,
1076 "etaoin.example,1972-12-31",
This page took 0.193564 seconds and 3 git commands to generate.