]>
Lady’s Gitweb - Etiquette/blob - model.test.js
4396d37def8892db01a6f32076ca066b31773a21
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 assertEquals({ ...new Tag().prefLabel
}, { "@value": "" });
111 it("[[Construct]] correctly sets the preferred label to a simple string", () => {
113 { ...new Tag("RelationshipTag", "Shadow, Me").prefLabel
},
114 { "@value": "Shadow, Me" },
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(".constructor", () => {
168 it("[[Get]] is `Function`", () => {
169 assertStrictEquals(Tag
.constructor, Function
);
173 describe(".fromIRI", () => {
174 it("[[Call]] returns the persisted tag with the given I·R·I", () => {
175 const tag
= new Tag();
177 const { identifier
, iri
} = tag
;
178 const retrieved
= Tag
.fromIRI(iri
);
180 Object
.getPrototypeOf(retrieved
),
183 assertStrictEquals(retrieved
.identifier
, identifier
);
186 it("[[Call]] returns undefined if no tag with the given I·R·I has been persisted", () => {
189 `https://${system.authorityName}/tag:${system.taggingEntity}:000-0000`,
195 it("[[Call]] throws if passed an invalid I·R·I", () => {
197 Tag
.fromIRI(`bad iri`);
202 describe(".fromIdentifier", () => {
203 it("[[Call]] returns the persisted tag with the given identifier", () => {
204 const tag
= new Tag();
206 const { identifier
} = tag
;
207 const retrieved
= Tag
.fromIdentifier(identifier
);
209 Object
.getPrototypeOf(retrieved
),
212 assertStrictEquals(retrieved
.identifier
, identifier
);
215 it("[[Call]] returns undefined if no tag with the given identifier has been persisted", () => {
216 assertStrictEquals(Tag
.fromIdentifier("000-0000"), undefined);
219 it("[[Call]] throws if passed an invalid identifier", () => {
221 Tag
.fromIdentifier(""); // wrong format
224 Tag
.fromIdentifier("100-0000"); // bad checksum
229 describe(".fromTagURI", () => {
230 it("[[Call]] returns the persisted tag with the given Tag U·R·I", () => {
231 const tag
= new Tag();
233 const { identifier
, tagURI
} = tag
;
234 const retrieved
= Tag
.fromTagURI(tagURI
);
236 Object
.getPrototypeOf(retrieved
),
239 assertStrictEquals(retrieved
.identifier
, identifier
);
242 it("[[Call]] returns undefined if no tag with the given Tag U·R·I has been persisted", () => {
244 Tag
.fromTagURI(`tag:${system.taggingEntity}:`),
248 Tag
.fromTagURI(`tag:${system.taggingEntity}:000-0000`),
253 it("[[Call]] throws if passed an invalid Tag U·R·I", () => {
255 Tag
.fromTagURI(""); // wrong format
259 "tag:unexample,1970-01-01:Z", // incorrect tagging entity
265 describe(".identifiers", () => {
266 it("[[Call]] yields all the persisted identifiers", () => {
267 const tags
= new Set(function* () {
270 // Generate 5 tags and remember their identifiers.
271 const tag
= new Tag();
273 yield tag
.identifier
;
277 new Set(Tag
.identifiers()),
283 describe(".system", () => {
284 it("[[Call]] returns the `TagSystem`", () => {
285 assertEquals(Tag
.system
, system
);
289 // `.[Storage.toInstance]` is tested by `.fromIdentifier`.
291 describe("::addAltLabel", () => {
292 it("[[Call]] does nothing if called with no arguments", () => {
293 const tag
= new Tag();
295 assertEquals([...tag
.altLabels()], []);
298 it("[[Call]] adds the provided alternative labels", () => {
299 const tag
= new Tag();
303 { "@value": "three", "@language": "en" },
306 Array
.from(tag
.altLabels(), ($) => ({ ...$ })),
310 { "@value": "three", "@language": "en" },
315 it("[[Call]] returns this", () => {
316 const tag
= new Tag();
317 assertStrictEquals(tag
.addAltLabel(), tag
);
321 describe("::addBroaderTag", () => {
322 it("[[Call]] does nothing if called with no arguments", () => {
323 const tag
= new Tag();
325 assertEquals([...tag
.broaderTags()], []);
328 it("[[Call]] adds the provided broader tags", () => {
329 const broader
= new Tag();
331 const broader2
= new Tag();
333 const tag
= new Tag();
334 tag
.addBroaderTag(broader
, broader2
);
336 Array
.from(tag
.broaderTags(), ($) => $.identifier
),
337 [broader
.identifier
, broader2
.identifier
],
341 it("[[Call]] returns this", () => {
342 const tag
= new Tag();
343 assertStrictEquals(tag
.addBroaderTag(), tag
);
346 it("[[Call]] throws when adding a non‐persisted tag", () => {
347 const tag
= new Tag();
349 tag
.addBroaderTag(new Tag());
353 it("[[Call]] throws when adding an unrecognized identifier", () => {
354 const tag
= new Tag();
356 tag
.addBroaderTag("000-0000"); // not persisted
359 tag
.addBroaderTag(""); // bad format
364 describe("::addHiddenLabel", () => {
365 it("[[Call]] does nothing if called with no arguments", () => {
366 const tag
= new Tag();
367 tag
.addHiddenLabel();
368 assertEquals([...tag
.hiddenLabels()], []);
371 it("[[Call]] adds the provided hidden labels", () => {
372 const tag
= new Tag();
376 { "@value": "three", "@language": "en" },
379 Array
.from(tag
.hiddenLabels(), ($) => ({ ...$ })),
383 { "@value": "three", "@language": "en" },
388 it("[[Call]] returns this", () => {
389 const tag
= new Tag();
390 assertStrictEquals(tag
.addHiddenLabel(), tag
);
394 describe("::addInCanonTag", () => {
395 it("[[Call]] does nothing if called with no arguments", () => {
396 const tag
= new Tag("EntityTag");
398 assertEquals([...tag
.inCanonTags()], []);
401 it("[[Call]] adds the provided canon tags", () => {
402 const canon
= new Tag("CanonTag");
404 const canon2
= new Tag("CanonTag");
406 const tag
= new Tag("EntityTag");
407 tag
.addInCanonTag(canon
, canon2
);
409 Array
.from(tag
.inCanonTags(), ($) => $.identifier
),
410 [canon
.identifier
, canon2
.identifier
],
414 it("[[Call]] returns this", () => {
415 const tag
= new Tag("EntityTag");
416 assertStrictEquals(tag
.addInCanonTag(), tag
);
419 it("[[Call]] throws when this is not a tag which can be placed in canon", () => {
420 const canon
= new Tag("CanonTag");
423 new Tag().addInCanonTag(canon
);
427 it("[[Call]] throws when provided with a non‐canon tag", () => {
428 const notCanon
= new Tag();
430 const tag
= new Tag("EntityTag");
432 tag
.addInCanonTag(notCanon
);
436 it("[[Call]] throws when adding a non‐persisted tag", () => {
437 const tag
= new Tag("EntityTag");
439 tag
.addInCanonTag(new Tag("CanonTag"));
443 it("[[Call]] throws when adding an unrecognized identifier", () => {
444 const tag
= new Tag("EntityTag");
446 tag
.addInCanonTag("000-0000"); // not persisted
449 tag
.addInCanonTag(""); // bad format
454 describe("::addInvolvesTag", () => {
455 it("[[Call]] does nothing if called with no arguments", () => {
456 const tag
= new Tag("ConceptualTag");
457 tag
.addInvolvesTag();
458 assertEquals([...tag
.involvesTags()], []);
461 it("[[Call]] adds the provided tags", () => {
462 const involved
= new Tag();
464 const involved2
= new Tag();
466 const tag
= new Tag("ConceptualTag");
467 tag
.addInvolvesTag(involved
, involved2
);
469 Array
.from(tag
.involvesTags(), ($) => $.identifier
),
470 [involved
.identifier
, involved2
.identifier
],
474 it("[[Call]] returns this", () => {
475 const tag
= new Tag("ConceptualTag");
476 assertStrictEquals(tag
.addInvolvesTag(), tag
);
479 it("[[Call]] throws when this is not a conceptual tag", () => {
480 const involved
= new Tag();
483 new Tag().addInvolvesTag(involved
);
487 it("[[Call]] throws when this is a relationship tag and provided with a non‐involvable tag", () => {
488 const notInvolved
= new Tag();
489 notInvolved
.persist();
490 const tag
= new Tag("RelationshipTag");
492 tag
.addInvolvesTag(notInvolved
);
496 it("[[Call]] throws when adding a non‐persisted tag", () => {
497 const tag
= new Tag("ConceptualTag");
499 tag
.addInvolvesTag(new Tag());
503 it("[[Call]] throws when adding an unrecognized identifier", () => {
504 const tag
= new Tag("ConceptualTag");
506 tag
.addInvolvesTag("000-0000"); // not persisted
509 tag
.addInvolvesTag(""); // bad format
514 // `::altLabels` is tested by `::addAltLabel`.
516 describe("::authorityName", () => {
517 it("[[Get]] returns the authority name of the tag system", () => {
519 new Tag().authorityName
,
520 system
.authorityName
,
525 // `::broaderTags` is tested by `::addBroaderTag`.
527 describe("::broaderTransitiveTags", () => {
528 it("[[Call]] returns broader tags transitively", () => {
529 const superBroad
= new Tag();
530 superBroad
.persist();
531 const broad
= new Tag();
532 broad
.addBroaderTag(superBroad
);
534 const tag
= new Tag();
535 tag
.addBroaderTag(broad
);
537 Array
.from(tag
.broaderTransitiveTags(), ($) => $.identifier
),
538 [broad
.identifier
, superBroad
.identifier
],
542 it("[[Call]] cannot recurse infinitely", () => {
543 const tag
= new Tag();
545 const broad
= new Tag();
546 broad
.addBroaderTag(tag
);
548 tag
.addBroaderTag(broad
);
551 Array
.from(tag
.broaderTransitiveTags(), ($) => $.identifier
),
552 [broad
.identifier
, tag
.identifier
],
557 describe("::deleteAltLabel", () => {
558 it("[[Call]] does nothing if called with no arguments", () => {
559 const tag
= new Tag();
560 tag
.addAltLabel("etaoin");
561 tag
.deleteAltLabel();
563 Array
.from(tag
.altLabels(), ($) => ({ ...$ })),
564 [{ "@value": "etaoin" }],
568 it("[[Call]] deletes only the provided hidden labels", () => {
569 const tag
= new Tag();
573 { "@value": "three", "@language": "en" },
579 { "@value": "three", "@language": "en" },
580 { "@value": "four", "@language": "en" },
583 Array
.from(tag
.altLabels(), ($) => ({ ...$ })),
584 [{ "@value": "four" }],
588 it("[[Call]] returns this", () => {
589 const tag
= new Tag();
590 assertStrictEquals(tag
.deleteAltLabel(), tag
);
594 describe("::deleteBroaderTag", () => {
595 it("[[Call]] does nothing if called with no arguments", () => {
596 const broader
= new Tag();
598 const tag
= new Tag();
599 tag
.addBroaderTag(broader
);
600 tag
.deleteBroaderTag();
602 Array
.from(tag
.broaderTags(), ($) => $.identifier
),
603 [broader
.identifier
],
607 it("[[Call]] deletes only the provided broader tags", () => {
608 const superBroader
= new Tag();
609 superBroader
.persist();
610 const broader
= new Tag();
611 broader
.addBroaderTag(superBroader
);
613 const broader2
= new Tag();
614 broader2
.addBroaderTag(superBroader
);
616 const tag
= new Tag();
617 tag
.addBroaderTag(broader
, broader2
);
618 tag
.deleteBroaderTag(broader
, superBroader
, "000-0000", "");
620 Array
.from(tag
.broaderTags(), ($) => $.identifier
),
621 [broader2
.identifier
],
625 it("[[Call]] returns this", () => {
626 const tag
= new Tag();
627 assertStrictEquals(tag
.deleteBroaderTag(), tag
);
631 describe("::deleteHiddenLabel", () => {
632 it("[[Call]] does nothing if called with no arguments", () => {
633 const tag
= new Tag();
634 tag
.addHiddenLabel("etaoin");
635 tag
.deleteHiddenLabel();
637 Array
.from(tag
.hiddenLabels(), ($) => ({ ...$ })),
638 [{ "@value": "etaoin" }],
642 it("[[Call]] deletes only the provided alternative labels", () => {
643 const tag
= new Tag();
647 { "@value": "three", "@language": "en" },
650 tag
.deleteHiddenLabel(
653 { "@value": "three", "@language": "en" },
654 { "@value": "four", "@language": "en" },
657 Array
.from(tag
.hiddenLabels(), ($) => ({ ...$ })),
658 [{ "@value": "four" }],
662 it("[[Call]] returns this", () => {
663 const tag
= new Tag();
664 assertStrictEquals(tag
.deleteHiddenLabel(), tag
);
668 describe("::deleteInCanonTag", () => {
669 it("[[Call]] does nothing if called with no arguments", () => {
670 const canon
= new Tag("CanonTag");
672 const tag
= new Tag("EntityTag");
673 tag
.addInCanonTag(canon
);
674 tag
.deleteInCanonTag();
676 Array
.from(tag
.inCanonTags(), ($) => $.identifier
),
681 it("[[Call]] deletes only the provided canon tags", () => {
682 const canon
= new Tag("CanonTag");
684 const canon2
= new Tag("CanonTag");
686 const tag
= new Tag("EntityTag");
687 tag
.addInCanonTag(canon
, canon2
);
688 tag
.deleteInCanonTag(canon
, "000-0000", "");
690 Array
.from(tag
.inCanonTags(), ($) => $.identifier
),
695 it("[[Call]] returns this", () => {
696 const tag
= new Tag("EntityTag");
697 assertStrictEquals(tag
.deleteInCanonTag(), tag
);
701 describe("::deleteInvolvesTag", () => {
702 it("[[Call]] does nothing if called with no arguments", () => {
703 const involved
= new Tag();
705 const tag
= new Tag("ConceptualTag");
706 tag
.addInvolvesTag(involved
);
707 tag
.deleteInvolvesTag();
709 Array
.from(tag
.involvesTags(), ($) => $.identifier
),
710 [involved
.identifier
],
714 it("[[Call]] deletes only the provided involved tags", () => {
715 const character
= new Tag("CharacterTag");
717 const involved
= new Tag("RelationshipTag");
718 involved
.addInvolvesTag(character
);
720 const involved2
= new Tag("RelationshipTag");
721 involved2
.addInvolvesTag(character
);
723 const tag
= new Tag("RelationshipTag");
724 tag
.addInvolvesTag(involved
, involved2
);
725 tag
.deleteInvolvesTag(involved
, character
, "000-0000", "");
727 Array
.from(tag
.involvesTags(), ($) => $.identifier
),
728 [involved2
.identifier
],
732 it("[[Call]] returns this", () => {
733 const tag
= new Tag("ConceptualTag");
734 assertStrictEquals(tag
.deleteInvolvesTag(), tag
);
738 describe("::hasInCanonTags", () => {
739 it("[[Call]] yields the persisted tags which have this tag in canon", () => {
740 const canon
= new Tag("CanonTag");
742 const entity
= new Tag("EntityTag");
743 entity
.addInCanonTag(canon
);
745 const entity2
= new Tag("EntityTag");
746 entity2
.addInCanonTag(canon
);
748 const tag
= Tag
.fromIdentifier(canon
.identifier
); // reload
750 Array
.from(tag
.hasInCanonTags(), ($) => $.identifier
),
751 [entity
.identifier
, entity2
.identifier
],
756 // `::hiddenLabels` is tested by `::addHiddenLabel`.
758 // `::identifier` is tested by a `.fromIdentifier`.
760 // `::inCanonTags` is tested by `::addInCanonTag`.
762 describe("::involvedInTags", () => {
763 it("[[Call]] yields the persisted tags which involve this tag", () => {
764 const involved
= new Tag();
766 const conceptual
= new Tag("ConceptualTag");
767 conceptual
.addInvolvesTag(involved
);
768 conceptual
.persist();
769 const conceptual2
= new Tag("ConceptualTag");
770 conceptual2
.addInvolvesTag(involved
);
771 conceptual2
.persist();
772 const tag
= Tag
.fromIdentifier(involved
.identifier
); // reload
774 Array
.from(tag
.involvedInTags(), ($) => $.identifier
),
775 [conceptual
.identifier
, conceptual2
.identifier
],
780 // `::involvesTags` is tested by `::addInvolvesTag`.
782 // `::iri` is tested by a `.fromIRI`.
784 // `::iriSpace` is tested by a `.fromIRI`.
786 // `::kind` is tested by the constructor.
788 describe("::narrowerTags", () => {
789 it("[[Call]] yields the persisted tags which are narrower than this tag", () => {
790 const broader
= new Tag();
792 const narrower
= new Tag();
793 narrower
.addBroaderTag(broader
);
795 const narrower2
= new Tag();
796 narrower2
.addBroaderTag(broader
);
798 const tag
= Tag
.fromIdentifier(broader
.identifier
); // reload
800 Array
.from(tag
.narrowerTags(), ($) => $.identifier
),
801 [narrower
.identifier
, narrower2
.identifier
],
806 describe("::narrowerTransitiveTags", () => {
807 it("[[Call]] returns narrower tags transitively", () => {
808 const broad
= new Tag();
810 const narrow
= new Tag();
811 narrow
.addBroaderTag(broad
);
813 const superNarrow
= new Tag();
814 superNarrow
.addBroaderTag(narrow
);
815 superNarrow
.persist();
816 const tag
= Tag
.fromIdentifier(broad
.identifier
); // reload
819 tag
.narrowerTransitiveTags(),
822 [narrow
.identifier
, superNarrow
.identifier
],
826 it("[[Call]] cannot recurse infinitely", () => {
827 const tag
= new Tag();
829 const broad
= new Tag();
830 broad
.addBroaderTag(tag
);
832 tag
.addBroaderTag(broad
);
835 Array
.from(tag
.broaderTransitiveTags(), ($) => $.identifier
),
836 [broad
.identifier
, tag
.identifier
],
841 describe("::persist", () => {
842 it("[[Call]] returns an object with expected properties if there were changes", () => {
843 const tag
= new Tag();
844 const activity
= tag
.persist();
849 "https://ns.1024.gdn/Tagging/discovery.context.jsonld",
854 assertArrayIncludes(activity
["@type"], ["TagActivity"]);
855 assert("endTime" in activity
);
858 it("[[Call]] returns a Create activity with a type predicate for new objects", () => {
859 const activity
= new Tag().persist();
860 assertEquals(activity
["@type"], ["TagActivity", "Create"]);
861 assertArrayIncludes(activity
.states
, [{
867 it("[[Call]] returns an Update activity for old objects", () => {
868 const tag
= new Tag();
870 tag
.prefLabel
= "etaoin";
871 const activity
= tag
.persist();
872 assertEquals(activity
["@type"], ["TagActivity", "Update"]);
875 it("[[Call]] states and unstates changes", () => {
876 const broader1
= new Tag();
878 const broader2
= new Tag();
880 const tag
= new Tag();
881 tag
.addBroaderTag(broader1
);
883 tag
.prefLabel
= "etaoin";
884 tag
.deleteBroaderTag(broader1
);
885 tag
.addBroaderTag(broader2
);
886 const activity
= tag
.persist();
887 assertObjectMatch(activity
, {
889 { predicate
: "prefLabel", object
: { "@value": "" } },
890 { predicate
: "broader", object
: broader1
.iri
},
893 { predicate
: "prefLabel", object
: { "@value": "etaoin" } },
894 { predicate
: "broader", object
: broader2
.iri
},
899 it("[[Call]] doesn’t state if there are no additions", () => {
900 const tag
= new Tag();
901 tag
.addAltLabel("etaoin");
903 tag
.deleteAltLabel("etaoin");
904 const activity
= tag
.persist();
905 assertFalse("state" in activity
);
908 it("[[Call]] doesn’t unstate if there are no removals", () => {
909 const tag
= new Tag();
911 tag
.addAltLabel("etaoin");
912 const activity
= tag
.persist();
913 assertFalse("unstate" in activity
);
916 it("[[Call]] returns null if no meaningful changes were made", () => {
917 const tag
= new Tag();
919 const activity
= tag
.persist();
920 assertStrictEquals(activity
, null);
923 it("[[Call]] returns undefined for a silent persist", () => {
924 const broader
= new Tag();
926 const tag
= new Tag();
927 tag
.prefLabel
= "etaoin";
928 tag
.addBroaderTag(broader
);
929 assertStrictEquals(tag
.persist(true), undefined);
933 describe("::prefLabel", () => {
934 it("[[Set]] sets the preferred label", () => {
935 const tag
= new Tag();
936 tag
.prefLabel
= "one";
937 assertEquals({ ...tag
.prefLabel
}, { "@value": "one" });
938 tag
.prefLabel
= { "@value": "two" };
939 assertEquals({ ...tag
.prefLabel
}, { "@value": "two" });
940 tag
.prefLabel
= { "@value": "three", "@language": "en" };
942 { ...tag
.prefLabel
},
943 { "@value": "three", "@language": "en" },
948 describe("::system", () => {
949 it("[[Get]] returns the tag system", () => {
950 assertStrictEquals(new Tag().system
, system
);
954 // `::tagURI` is tested by a `.fromTagURI`.
956 describe("::taggingEntity", () => {
957 it("[[Get]] returns the tagging entity of the tag system", () => {
959 new Tag().taggingEntity
,
960 system
.taggingEntity
,
965 describe("::toString", () => {
966 it("[[Get]] returns the string value of the preferred label", () => {
967 const tag
= new Tag();
968 tag
.prefLabel
= { "@value": "etaoin", "@language": "zxx" };
969 assertStrictEquals(tag
.toString(), "etaoin");
973 // `::[Storage.toObject]` is tested by `::persist`.
976 describe("::authorityName", () => {
977 it("[[Get]] returns the authority name", () => {
978 const system
= new TagSystem("etaoin.example", "1972-12-31");
979 assertStrictEquals(system
.authorityName
, "etaoin.example");
983 describe("::authorityName", () => {
984 it("[[Get]] returns the date", () => {
985 const system
= new TagSystem("etaoin.example", "1972-12-31");
986 assertStrictEquals(system
.date
, "1972-12-31");
990 describe("::identifiers", () => {
991 it("[[Get]] yields the extant entities", () => {
992 const system
= new TagSystem("etaoin.example", "1972-12-31");
993 const tags
= new Set(function* () {
996 // Generate 5 tags and remember their identifiers.
997 const tag
= new system
.Tag();
999 yield tag
.identifier
;
1003 new Set(Array
.from(system
.entities(), ($) => $.identifier
)),
1009 describe("::identifier", () => {
1010 it("[[Get]] returns the identifier", () => {
1011 const system
= new TagSystem("etaoin.example", "1972-12-31");
1012 assertStrictEquals(system
.identifier
, "");
1013 const system2
= new TagSystem(
1018 assertStrictEquals(system2
.identifier
, "etaoin");
1022 describe("::identifiers", () => {
1023 it("[[Get]] yields the identifiers in use", () => {
1024 const system
= new TagSystem("etaoin.example", "1972-12-31");
1025 const tags
= new Set(function* () {
1028 // Generate 5 tags and remember their identifiers.
1029 const tag
= new system
.Tag();
1031 yield tag
.identifier
;
1034 assertEquals(new Set(system
.identifiers()), tags
);
1038 describe("::iri", () => {
1039 it("[[Get]] returns the I·R·I", () => {
1040 const system
= new TagSystem("etaoin.example", "1972-12-31");
1043 "https://etaoin.example/tag:etaoin.example,1972-12-31:",
1045 const system2
= new TagSystem(
1052 "https://etaoin.example/tag:etaoin.example,1972-12-31:etaoin",
1057 describe("::iriSpace", () => {
1058 it("[[Get]] returns the I·R·I space", () => {
1059 const system
= new TagSystem("etaoin.example", "1972-12-31");
1062 "https://etaoin.example/tag:etaoin.example,1972-12-31:",
1064 const system2
= new TagSystem(
1071 "https://etaoin.example/tag:etaoin.example,1972-12-31:",
1076 describe("::tagURI", () => {
1077 it("[[Get]] returns the Tag U·R·I", () => {
1078 const system
= new TagSystem("etaoin.example", "1972-12-31");
1081 "tag:etaoin.example,1972-12-31:",
1083 const system2
= new TagSystem(
1090 "tag:etaoin.example,1972-12-31:etaoin",
1095 describe("::taggingEntity", () => {
1096 it("[[Get]] returns the tagging entity", () => {
1097 const system
= new TagSystem("etaoin.example", "1972-12-31");
1099 system
.taggingEntity
,
1100 "etaoin.example,1972-12-31",
This page took 0.209966 seconds and 3 git commands to generate.