]>
Lady’s Gitweb - Etiquette/blob - model.test.js
7190830c3a043dd200bfecf4ed7d68d924e6b32c
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]] returns null if passed an invalid I·R·I", () => {
190 assertStrictEquals(Tag
.fromIRI(`bad iri`), null);
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
.fromIRI(`tag:${system.taggingEntity}:`),
240 Tag
.fromIRI(`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 // `::kind` is tested by the constructor.
768 describe("::narrowerTags", () => {
769 it("[[Call]] yields the persisted tags which are narrower than this tag", () => {
770 const broader
= new Tag();
772 const narrower
= new Tag();
773 narrower
.addBroaderTag(broader
);
775 const narrower2
= new Tag();
776 narrower2
.addBroaderTag(broader
);
778 const tag
= Tag
.fromIdentifier(broader
.identifier
); // reload
780 Array
.from(tag
.narrowerTags(), ($) => $.identifier
),
781 [narrower
.identifier
, narrower2
.identifier
],
786 describe("::narrowerTransitiveTags", () => {
787 it("[[Call]] returns narrower tags transitively", () => {
788 const broad
= new Tag();
790 const narrow
= new Tag();
791 narrow
.addBroaderTag(broad
);
793 const superNarrow
= new Tag();
794 superNarrow
.addBroaderTag(narrow
);
795 superNarrow
.persist();
796 const tag
= Tag
.fromIdentifier(broad
.identifier
); // reload
799 tag
.narrowerTransitiveTags(),
802 [narrow
.identifier
, superNarrow
.identifier
],
806 it("[[Call]] cannot recurse infinitely", () => {
807 const tag
= new Tag();
809 const broad
= new Tag();
810 broad
.addBroaderTag(tag
);
812 tag
.addBroaderTag(broad
);
815 Array
.from(tag
.broaderTransitiveTags(), ($) => $.identifier
),
816 [broad
.identifier
, tag
.identifier
],
821 describe("::persist", () => {
822 it("[[Call]] returns an object with expected properties if there were changes", () => {
823 const tag
= new Tag();
824 const activity
= tag
.persist();
829 "https://ns.1024.gdn/Tagging/discovery.context.jsonld",
834 assertArrayIncludes(activity
["@type"], ["TagActivity"]);
835 assert("endTime" in activity
);
838 it("[[Call]] returns a Create activity with a type predicate for new objects", () => {
839 const activity
= new Tag().persist();
840 assertEquals(activity
["@type"], ["TagActivity", "Create"]);
841 assertArrayIncludes(activity
.states
, [{
847 it("[[Call]] returns an Update activity for old objects", () => {
848 const tag
= new Tag();
850 tag
.prefLabel
= "etaoin";
851 const activity
= tag
.persist();
852 assertEquals(activity
["@type"], ["TagActivity", "Update"]);
855 it("[[Call]] states and unstates changes", () => {
856 const broader1
= new Tag();
858 const broader2
= new Tag();
860 const tag
= new Tag();
861 tag
.addBroaderTag(broader1
);
863 tag
.prefLabel
= "etaoin";
864 tag
.deleteBroaderTag(broader1
);
865 tag
.addBroaderTag(broader2
);
866 const activity
= tag
.persist();
867 assertObjectMatch(activity
, {
869 { predicate
: "prefLabel", object
: { "@value": "" } },
870 { predicate
: "broader", object
: broader1
.iri
},
873 { predicate
: "prefLabel", object
: { "@value": "etaoin" } },
874 { predicate
: "broader", object
: broader2
.iri
},
879 it("[[Call]] doesn’t state if there are no additions", () => {
880 const tag
= new Tag();
881 tag
.addAltLabel("etaoin");
883 tag
.deleteAltLabel("etaoin");
884 const activity
= tag
.persist();
885 assertFalse("state" in activity
);
888 it("[[Call]] doesn’t unstate if there are no removals", () => {
889 const tag
= new Tag();
891 tag
.addAltLabel("etaoin");
892 const activity
= tag
.persist();
893 assertFalse("unstate" in activity
);
896 it("[[Call]] returns null if no meaningful changes were made", () => {
897 const tag
= new Tag();
899 const activity
= tag
.persist();
900 assertStrictEquals(activity
, null);
903 it("[[Call]] returns undefined for a silent persist", () => {
904 const broader
= new Tag();
906 const tag
= new Tag();
907 tag
.prefLabel
= "etaoin";
908 tag
.addBroaderTag(broader
);
909 assertStrictEquals(tag
.persist(true), undefined);
913 describe("::prefLabel", () => {
914 it("[[Set]] sets the preferred label", () => {
915 const tag
= new Tag();
916 tag
.prefLabel
= "one";
917 assertStrictEquals(tag
.prefLabel
, "one");
918 tag
.prefLabel
= { "@value": "two" };
919 assertStrictEquals(tag
.prefLabel
, "two");
920 tag
.prefLabel
= { "@value": "three", "@language": "en" };
922 { ...tag
.prefLabel
},
923 { "@value": "three", "@language": "en" },
928 // `::tagURI` is tested by a `.fromTagURI`.
930 describe("::taggingEntity", () => {
931 it("[[Get]] returns the tagging entity of the tag system", () => {
933 new Tag().taggingEntity
,
934 system
.taggingEntity
,
939 describe("::toString", () => {
940 it("[[Get]] returns the string value of the preferred label", () => {
941 const tag
= new Tag();
942 tag
.prefLabel
= { "@value": "etaoin", "@language": "zxx" };
943 assertStrictEquals(tag
.toString(), "etaoin");
947 // `::[Storage.toObject]` is tested by `::persist`.
950 describe("::authorityName", () => {
951 it("[[Get]] returns the authority name", () => {
952 const system
= new TagSystem("etaoin.example", "1972-12-31");
953 assertStrictEquals(system
.authorityName
, "etaoin.example");
957 describe("::authorityName", () => {
958 it("[[Get]] returns the date", () => {
959 const system
= new TagSystem("etaoin.example", "1972-12-31");
960 assertStrictEquals(system
.date
, "1972-12-31");
964 describe("::identifiers", () => {
965 it("[[Get]] yields the extant entities", () => {
966 const system
= new TagSystem("etaoin.example", "1972-12-31");
967 const tags
= new Set(function* () {
970 // Generate 5 tags and remember their identifiers.
971 const tag
= new system
.Tag();
973 yield tag
.identifier
;
977 new Set(Array
.from(system
.entities(), ($) => $.identifier
)),
983 describe("::identifier", () => {
984 it("[[Get]] returns the identifier", () => {
985 const system
= new TagSystem("etaoin.example", "1972-12-31");
986 assertStrictEquals(system
.identifier
, "");
987 const system2
= new TagSystem(
992 assertStrictEquals(system2
.identifier
, "etaoin");
996 describe("::identifiers", () => {
997 it("[[Get]] yields the identifiers in use", () => {
998 const system
= new TagSystem("etaoin.example", "1972-12-31");
999 const tags
= new Set(function* () {
1002 // Generate 5 tags and remember their identifiers.
1003 const tag
= new system
.Tag();
1005 yield tag
.identifier
;
1008 assertEquals(new Set(system
.identifiers()), tags
);
1012 describe("::iri", () => {
1013 it("[[Get]] returns the I·R·I", () => {
1014 const system
= new TagSystem("etaoin.example", "1972-12-31");
1017 "https://etaoin.example/tag:etaoin.example,1972-12-31:",
1019 const system2
= new TagSystem(
1026 "https://etaoin.example/tag:etaoin.example,1972-12-31:etaoin",
1031 describe("::tagURI", () => {
1032 it("[[Get]] returns the Tag U·R·I", () => {
1033 const system
= new TagSystem("etaoin.example", "1972-12-31");
1036 "tag:etaoin.example,1972-12-31:",
1038 const system2
= new TagSystem(
1045 "tag:etaoin.example,1972-12-31:etaoin",
1050 describe("::taggingEntity", () => {
1051 it("[[Get]] returns the tagging entity", () => {
1052 const system
= new TagSystem("etaoin.example", "1972-12-31");
1054 system
.taggingEntity
,
1055 "etaoin.example,1972-12-31",
This page took 0.217209 seconds and 3 git commands to generate.