capns 0.57.11569 → 0.58.11575
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/capns.js +15 -1
- package/capns.test.js +67 -3
- package/package.json +1 -1
package/capns.js
CHANGED
|
@@ -768,7 +768,7 @@ const MEDIA_OBJECT_ARRAY = 'media:form=list;textable';
|
|
|
768
768
|
const MEDIA_BINARY = 'media:bytes';
|
|
769
769
|
const MEDIA_VOID = 'media:void';
|
|
770
770
|
// Semantic content types
|
|
771
|
-
const MEDIA_PNG = 'media:png;bytes';
|
|
771
|
+
const MEDIA_PNG = 'media:image;png;bytes';
|
|
772
772
|
const MEDIA_AUDIO = 'media:wav;audio;bytes;';
|
|
773
773
|
const MEDIA_VIDEO = 'media:video;bytes';
|
|
774
774
|
// Semantic AI input types
|
|
@@ -785,7 +785,15 @@ const MEDIA_LOG = 'media:log;textable';
|
|
|
785
785
|
const MEDIA_HTML = 'media:html;textable';
|
|
786
786
|
const MEDIA_XML = 'media:xml;textable';
|
|
787
787
|
const MEDIA_JSON = 'media:json;textable;form=map';
|
|
788
|
+
const MEDIA_JSON_SCHEMA = 'media:json;json-schema;textable;form=map';
|
|
788
789
|
const MEDIA_YAML = 'media:yaml;textable;form=map';
|
|
790
|
+
// Semantic input types
|
|
791
|
+
const MEDIA_MODEL_SPEC = 'media:model-spec;textable;form=scalar';
|
|
792
|
+
const MEDIA_MODEL_REPO = 'media:model-repo;textable;form=map';
|
|
793
|
+
// Semantic output types
|
|
794
|
+
const MEDIA_MODEL_DIM = 'media:model-dim;integer;textable;numeric;form=scalar';
|
|
795
|
+
const MEDIA_DECISION = 'media:decision;bool;textable;form=scalar';
|
|
796
|
+
const MEDIA_DECISION_ARRAY = 'media:decision;bool;textable;form=list';
|
|
789
797
|
|
|
790
798
|
// =============================================================================
|
|
791
799
|
// SCHEMA URL CONFIGURATION
|
|
@@ -3534,7 +3542,13 @@ module.exports = {
|
|
|
3534
3542
|
MEDIA_HTML,
|
|
3535
3543
|
MEDIA_XML,
|
|
3536
3544
|
MEDIA_JSON,
|
|
3545
|
+
MEDIA_JSON_SCHEMA,
|
|
3537
3546
|
MEDIA_YAML,
|
|
3547
|
+
MEDIA_MODEL_SPEC,
|
|
3548
|
+
MEDIA_MODEL_REPO,
|
|
3549
|
+
MEDIA_MODEL_DIM,
|
|
3550
|
+
MEDIA_DECISION,
|
|
3551
|
+
MEDIA_DECISION_ARRAY,
|
|
3538
3552
|
CapMatrixError,
|
|
3539
3553
|
CapMatrix,
|
|
3540
3554
|
BestCapSetMatch,
|
package/capns.test.js
CHANGED
|
@@ -77,6 +77,7 @@ function testUrn(tags) {
|
|
|
77
77
|
|
|
78
78
|
// Test suite - defined at the end of file
|
|
79
79
|
|
|
80
|
+
// TEST001: Test that cap URN is created with tags parsed correctly and direction specs accessible
|
|
80
81
|
function testCapUrnCreation() {
|
|
81
82
|
console.log('Testing Cap URN creation...');
|
|
82
83
|
|
|
@@ -90,6 +91,7 @@ function testCapUrnCreation() {
|
|
|
90
91
|
console.log(' ✓ Cap URN creation');
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
// TEST002: Test that tag keys and values are normalized to lowercase for case-insensitive comparison
|
|
93
95
|
function testCaseInsensitive() {
|
|
94
96
|
console.log('Testing case insensitive behavior...');
|
|
95
97
|
|
|
@@ -125,6 +127,7 @@ function testCaseInsensitive() {
|
|
|
125
127
|
console.log(' ✓ Case insensitive behavior');
|
|
126
128
|
}
|
|
127
129
|
|
|
130
|
+
// TEST003: Test that URN without cap prefix is rejected with MISSING_CAP_PREFIX error
|
|
128
131
|
function testCapPrefixRequired() {
|
|
129
132
|
console.log('Testing cap: prefix requirement...');
|
|
130
133
|
|
|
@@ -142,6 +145,7 @@ function testCapPrefixRequired() {
|
|
|
142
145
|
console.log(' ✓ Cap prefix requirement');
|
|
143
146
|
}
|
|
144
147
|
|
|
148
|
+
// TEST004: Test that URNs with and without trailing semicolon are equivalent
|
|
145
149
|
function testTrailingSemicolonEquivalence() {
|
|
146
150
|
console.log('Testing trailing semicolon equivalence...');
|
|
147
151
|
|
|
@@ -162,6 +166,7 @@ function testTrailingSemicolonEquivalence() {
|
|
|
162
166
|
console.log(' ✓ Trailing semicolon equivalence');
|
|
163
167
|
}
|
|
164
168
|
|
|
169
|
+
// TEST005: Test that toString produces canonical form with alphabetically sorted tags
|
|
165
170
|
function testCanonicalStringFormat() {
|
|
166
171
|
console.log('Testing canonical string format...');
|
|
167
172
|
|
|
@@ -174,6 +179,7 @@ function testCanonicalStringFormat() {
|
|
|
174
179
|
console.log(' ✓ Canonical string format');
|
|
175
180
|
}
|
|
176
181
|
|
|
182
|
+
// TEST006: Test that cap matches request with exact tags, subset tags, and wildcards
|
|
177
183
|
function testTagMatching() {
|
|
178
184
|
console.log('Testing tag matching...');
|
|
179
185
|
|
|
@@ -202,6 +208,7 @@ function testTagMatching() {
|
|
|
202
208
|
console.log(' ✓ Tag matching');
|
|
203
209
|
}
|
|
204
210
|
|
|
211
|
+
// TEST007: Test that missing tags are treated as wildcards for matching
|
|
205
212
|
function testMissingTagHandling() {
|
|
206
213
|
console.log('Testing missing tag handling...');
|
|
207
214
|
|
|
@@ -219,6 +226,7 @@ function testMissingTagHandling() {
|
|
|
219
226
|
console.log(' ✓ Missing tag handling');
|
|
220
227
|
}
|
|
221
228
|
|
|
229
|
+
// TEST008: Test that specificity counts non-wildcard tags including in and out
|
|
222
230
|
function testSpecificity() {
|
|
223
231
|
console.log('Testing specificity...');
|
|
224
232
|
|
|
@@ -241,6 +249,7 @@ function testSpecificity() {
|
|
|
241
249
|
console.log(' ✓ Specificity');
|
|
242
250
|
}
|
|
243
251
|
|
|
252
|
+
// TEST009: Test that compatibility checks if caps can handle same requests
|
|
244
253
|
function testCompatibility() {
|
|
245
254
|
console.log('Testing compatibility...');
|
|
246
255
|
|
|
@@ -264,6 +273,7 @@ function testCompatibility() {
|
|
|
264
273
|
console.log(' ✓ Compatibility');
|
|
265
274
|
}
|
|
266
275
|
|
|
276
|
+
// TEST010: Test that CapUrnBuilder creates valid URN with tags and direction specs
|
|
267
277
|
function testBuilder() {
|
|
268
278
|
console.log('Testing builder...');
|
|
269
279
|
|
|
@@ -297,6 +307,7 @@ function testBuilder() {
|
|
|
297
307
|
console.log(' ✓ Builder');
|
|
298
308
|
}
|
|
299
309
|
|
|
310
|
+
// TEST011: Test convenience methods withTag, withoutTag, withInSpec, withOutSpec, merge, subset, withWildcardTag
|
|
300
311
|
function testConvenienceMethods() {
|
|
301
312
|
console.log('Testing convenience methods...');
|
|
302
313
|
|
|
@@ -359,6 +370,7 @@ function testConvenienceMethods() {
|
|
|
359
370
|
console.log(' ✓ Convenience methods');
|
|
360
371
|
}
|
|
361
372
|
|
|
373
|
+
// TEST012: Test that CapMatcher finds best and all matches from cap list
|
|
362
374
|
function testCapMatcher() {
|
|
363
375
|
console.log('Testing CapMatcher...');
|
|
364
376
|
|
|
@@ -385,6 +397,7 @@ function testCapMatcher() {
|
|
|
385
397
|
console.log(' ✓ CapMatcher');
|
|
386
398
|
}
|
|
387
399
|
|
|
400
|
+
// TEST013: Test that cap URN serializes to and deserializes from JSON
|
|
388
401
|
function testJSONSerialization() {
|
|
389
402
|
console.log('Testing JSON serialization...');
|
|
390
403
|
|
|
@@ -400,6 +413,7 @@ function testJSONSerialization() {
|
|
|
400
413
|
console.log(' ✓ JSON serialization');
|
|
401
414
|
}
|
|
402
415
|
|
|
416
|
+
// TEST014: Test that empty cap URN without in/out fails, minimal URN with just in/out succeeds
|
|
403
417
|
function testEmptyCapUrn() {
|
|
404
418
|
console.log('Testing empty cap URN now fails (in/out required)...');
|
|
405
419
|
|
|
@@ -432,6 +446,7 @@ function testEmptyCapUrn() {
|
|
|
432
446
|
console.log(' ✓ Empty cap URN now fails (in/out required)');
|
|
433
447
|
}
|
|
434
448
|
|
|
449
|
+
// TEST015: Test that URN supports forward slashes and colons in tag values
|
|
435
450
|
function testExtendedCharacterSupport() {
|
|
436
451
|
console.log('Testing extended character support...');
|
|
437
452
|
|
|
@@ -443,6 +458,7 @@ function testExtendedCharacterSupport() {
|
|
|
443
458
|
console.log(' ✓ Extended character support');
|
|
444
459
|
}
|
|
445
460
|
|
|
461
|
+
// TEST016: Test that wildcard is rejected in keys but accepted in values
|
|
446
462
|
function testWildcardRestrictions() {
|
|
447
463
|
console.log('Testing wildcard restrictions...');
|
|
448
464
|
|
|
@@ -465,6 +481,7 @@ function testWildcardRestrictions() {
|
|
|
465
481
|
console.log(' ✓ Wildcard restrictions');
|
|
466
482
|
}
|
|
467
483
|
|
|
484
|
+
// TEST017: Test that duplicate keys in URN are rejected with DUPLICATE_KEY error
|
|
468
485
|
function testDuplicateKeyRejection() {
|
|
469
486
|
console.log('Testing duplicate key rejection...');
|
|
470
487
|
|
|
@@ -478,6 +495,7 @@ function testDuplicateKeyRejection() {
|
|
|
478
495
|
console.log(' ✓ Duplicate key rejection');
|
|
479
496
|
}
|
|
480
497
|
|
|
498
|
+
// TEST018: Test that pure numeric keys are rejected but mixed alphanumeric keys are allowed
|
|
481
499
|
function testNumericKeyRestriction() {
|
|
482
500
|
console.log('Testing numeric key restriction...');
|
|
483
501
|
|
|
@@ -506,6 +524,7 @@ function testNumericKeyRestriction() {
|
|
|
506
524
|
// NEW FORMAT TESTS - Spec ID Resolution and MediaSpec
|
|
507
525
|
// ============================================================================
|
|
508
526
|
|
|
527
|
+
// TEST057: Test MediaSpec parses canonical format without content-type prefix
|
|
509
528
|
function testMediaSpecCanonicalFormat() {
|
|
510
529
|
console.log('Testing MediaSpec canonical format...');
|
|
511
530
|
|
|
@@ -526,6 +545,7 @@ function testMediaSpecCanonicalFormat() {
|
|
|
526
545
|
console.log(' ✓ MediaSpec canonical format');
|
|
527
546
|
}
|
|
528
547
|
|
|
548
|
+
// TEST058: Test MediaSpec fails hard on legacy content-type prefix format
|
|
529
549
|
function testMediaSpecLegacyFormatRejection() {
|
|
530
550
|
console.log('Testing legacy format rejection...');
|
|
531
551
|
|
|
@@ -545,6 +565,7 @@ function testMediaSpecLegacyFormatRejection() {
|
|
|
545
565
|
console.log(' ✓ Legacy format rejection');
|
|
546
566
|
}
|
|
547
567
|
|
|
568
|
+
// TEST059: Test built-in media URNs are recognized by isBuiltinMediaUrn
|
|
548
569
|
function testBuiltinSpecIds() {
|
|
549
570
|
console.log('Testing built-in spec IDs...');
|
|
550
571
|
|
|
@@ -562,6 +583,7 @@ function testBuiltinSpecIds() {
|
|
|
562
583
|
console.log(' ✓ Built-in spec IDs');
|
|
563
584
|
}
|
|
564
585
|
|
|
586
|
+
// TEST060: Test resolveMediaUrn resolves built-in media URNs to MediaSpec
|
|
565
587
|
function testSpecIdResolution() {
|
|
566
588
|
console.log('Testing spec ID resolution...');
|
|
567
589
|
|
|
@@ -584,6 +606,7 @@ function testSpecIdResolution() {
|
|
|
584
606
|
console.log(' ✓ Spec ID resolution');
|
|
585
607
|
}
|
|
586
608
|
|
|
609
|
+
// TEST061: Test resolveMediaUrn resolves custom media URNs from mediaSpecs table
|
|
587
610
|
function testMediaUrnResolutionWithMediaSpecs() {
|
|
588
611
|
console.log('Testing media URN resolution with custom mediaSpecs...');
|
|
589
612
|
|
|
@@ -615,6 +638,7 @@ function testMediaUrnResolutionWithMediaSpecs() {
|
|
|
615
638
|
console.log(' ✓ Media URN resolution with custom mediaSpecs');
|
|
616
639
|
}
|
|
617
640
|
|
|
641
|
+
// TEST062: Test resolveMediaUrn fails hard on unresolvable media URN
|
|
618
642
|
function testMediaUrnResolutionFailHard() {
|
|
619
643
|
console.log('Testing media URN resolution fail hard...');
|
|
620
644
|
|
|
@@ -634,6 +658,7 @@ function testMediaUrnResolutionFailHard() {
|
|
|
634
658
|
console.log(' ✓ Media URN resolution fail hard');
|
|
635
659
|
}
|
|
636
660
|
|
|
661
|
+
// TEST063: Test metadata is propagated from object form media spec definition
|
|
637
662
|
function testMetadataPropagation() {
|
|
638
663
|
console.log('Testing metadata propagation...');
|
|
639
664
|
|
|
@@ -664,6 +689,7 @@ function testMetadataPropagation() {
|
|
|
664
689
|
console.log(' ✓ Metadata propagation from object definition');
|
|
665
690
|
}
|
|
666
691
|
|
|
692
|
+
// TEST064: Test string form media spec definition has no metadata
|
|
667
693
|
function testMetadataForStringDef() {
|
|
668
694
|
console.log('Testing metadata for string definition...');
|
|
669
695
|
|
|
@@ -678,6 +704,7 @@ function testMetadataForStringDef() {
|
|
|
678
704
|
console.log(' ✓ String form has no metadata');
|
|
679
705
|
}
|
|
680
706
|
|
|
707
|
+
// TEST065: Test built-in media URNs have no metadata
|
|
681
708
|
function testMetadataForBuiltin() {
|
|
682
709
|
console.log('Testing metadata for built-in...');
|
|
683
710
|
|
|
@@ -688,6 +715,7 @@ function testMetadataForBuiltin() {
|
|
|
688
715
|
console.log(' ✓ Built-in has no metadata');
|
|
689
716
|
}
|
|
690
717
|
|
|
718
|
+
// TEST066: Test metadata and validation coexist in media spec definition
|
|
691
719
|
function testMetadataWithValidation() {
|
|
692
720
|
console.log('Testing metadata with validation...');
|
|
693
721
|
|
|
@@ -723,6 +751,7 @@ function testMetadataWithValidation() {
|
|
|
723
751
|
console.log(' ✓ Metadata coexists with validation');
|
|
724
752
|
}
|
|
725
753
|
|
|
754
|
+
// TEST108: Test Cap with mediaSpecs resolves custom and built-in media URNs
|
|
726
755
|
function testCapWithMediaSpecs() {
|
|
727
756
|
console.log('Testing Cap with mediaSpecs...');
|
|
728
757
|
|
|
@@ -757,6 +786,7 @@ function testCapWithMediaSpecs() {
|
|
|
757
786
|
console.log(' ✓ Cap with mediaSpecs');
|
|
758
787
|
}
|
|
759
788
|
|
|
789
|
+
// TEST109: Test Cap JSON serialization includes mediaSpecs and direction specs
|
|
760
790
|
function testCapJSONSerialization() {
|
|
761
791
|
console.log('Testing Cap JSON serialization with mediaSpecs...');
|
|
762
792
|
|
|
@@ -789,6 +819,7 @@ function testCapJSONSerialization() {
|
|
|
789
819
|
console.log(' ✓ Cap JSON serialization with mediaSpecs');
|
|
790
820
|
}
|
|
791
821
|
|
|
822
|
+
// TEST019: Test op tag is used instead of deprecated action tag
|
|
792
823
|
function testOpTagRename() {
|
|
793
824
|
console.log('Testing op tag (renamed from action)...');
|
|
794
825
|
|
|
@@ -815,6 +846,7 @@ function testOpTagRename() {
|
|
|
815
846
|
// All implementations (Rust, Go, JS, ObjC) must pass these identically
|
|
816
847
|
// ============================================================================
|
|
817
848
|
|
|
849
|
+
// TEST020: Test matching semantics - exact match including in/out
|
|
818
850
|
function testMatchingSemantics_Test1_ExactMatch() {
|
|
819
851
|
console.log('Testing Matching Semantics Test 1: Exact match...');
|
|
820
852
|
// Test 1: Exact match (including in/out)
|
|
@@ -827,6 +859,7 @@ function testMatchingSemantics_Test1_ExactMatch() {
|
|
|
827
859
|
console.log(' ✓ Test 1: Exact match');
|
|
828
860
|
}
|
|
829
861
|
|
|
862
|
+
// TEST021: Test matching semantics - cap missing tag treated as implicit wildcard
|
|
830
863
|
function testMatchingSemantics_Test2_CapMissingTag() {
|
|
831
864
|
console.log('Testing Matching Semantics Test 2: Cap missing tag...');
|
|
832
865
|
// Test 2: Cap missing tag (implicit wildcard for other tags, not in/out)
|
|
@@ -839,6 +872,7 @@ function testMatchingSemantics_Test2_CapMissingTag() {
|
|
|
839
872
|
console.log(' ✓ Test 2: Cap missing tag');
|
|
840
873
|
}
|
|
841
874
|
|
|
875
|
+
// TEST022: Test matching semantics - cap with extra tag matches request
|
|
842
876
|
function testMatchingSemantics_Test3_CapHasExtraTag() {
|
|
843
877
|
console.log('Testing Matching Semantics Test 3: Cap has extra tag...');
|
|
844
878
|
// Test 3: Cap has extra tag
|
|
@@ -851,6 +885,7 @@ function testMatchingSemantics_Test3_CapHasExtraTag() {
|
|
|
851
885
|
console.log(' ✓ Test 3: Cap has extra tag');
|
|
852
886
|
}
|
|
853
887
|
|
|
888
|
+
// TEST023: Test matching semantics - request with wildcard matches specific cap
|
|
854
889
|
function testMatchingSemantics_Test4_RequestHasWildcard() {
|
|
855
890
|
console.log('Testing Matching Semantics Test 4: Request has wildcard...');
|
|
856
891
|
// Test 4: Request has wildcard
|
|
@@ -863,6 +898,7 @@ function testMatchingSemantics_Test4_RequestHasWildcard() {
|
|
|
863
898
|
console.log(' ✓ Test 4: Request has wildcard');
|
|
864
899
|
}
|
|
865
900
|
|
|
901
|
+
// TEST024: Test matching semantics - cap with wildcard matches specific request
|
|
866
902
|
function testMatchingSemantics_Test5_CapHasWildcard() {
|
|
867
903
|
console.log('Testing Matching Semantics Test 5: Cap has wildcard...');
|
|
868
904
|
// Test 5: Cap has wildcard
|
|
@@ -875,6 +911,7 @@ function testMatchingSemantics_Test5_CapHasWildcard() {
|
|
|
875
911
|
console.log(' ✓ Test 5: Cap has wildcard');
|
|
876
912
|
}
|
|
877
913
|
|
|
914
|
+
// TEST025: Test matching semantics - value mismatch does not match
|
|
878
915
|
function testMatchingSemantics_Test6_ValueMismatch() {
|
|
879
916
|
console.log('Testing Matching Semantics Test 6: Value mismatch...');
|
|
880
917
|
// Test 6: Value mismatch
|
|
@@ -887,6 +924,7 @@ function testMatchingSemantics_Test6_ValueMismatch() {
|
|
|
887
924
|
console.log(' ✓ Test 6: Value mismatch');
|
|
888
925
|
}
|
|
889
926
|
|
|
927
|
+
// TEST026: Test matching semantics - fallback pattern with missing tag as implicit wildcard
|
|
890
928
|
function testMatchingSemantics_Test7_FallbackPattern() {
|
|
891
929
|
console.log('Testing Matching Semantics Test 7: Fallback pattern...');
|
|
892
930
|
// Test 7: Fallback pattern
|
|
@@ -899,6 +937,7 @@ function testMatchingSemantics_Test7_FallbackPattern() {
|
|
|
899
937
|
console.log(' ✓ Test 7: Fallback pattern');
|
|
900
938
|
}
|
|
901
939
|
|
|
940
|
+
// TEST027: Test matching semantics - wildcard cap with in=* out=* matches anything
|
|
902
941
|
function testMatchingSemantics_Test8_WildcardCapMatchesAnything() {
|
|
903
942
|
console.log('Testing Matching Semantics Test 8: Wildcard cap matches anything...');
|
|
904
943
|
// Test 8: Wildcard cap matches anything (replaces empty cap test)
|
|
@@ -911,6 +950,7 @@ function testMatchingSemantics_Test8_WildcardCapMatchesAnything() {
|
|
|
911
950
|
console.log(' ✓ Test 8: Wildcard cap matches anything');
|
|
912
951
|
}
|
|
913
952
|
|
|
953
|
+
// TEST028: Test matching semantics - cross-dimension independence for other tags
|
|
914
954
|
function testMatchingSemantics_Test9_CrossDimensionIndependence() {
|
|
915
955
|
console.log('Testing Matching Semantics Test 9: Cross-dimension independence...');
|
|
916
956
|
// Test 9: Cross-dimension independence (for other tags, not in/out)
|
|
@@ -923,6 +963,7 @@ function testMatchingSemantics_Test9_CrossDimensionIndependence() {
|
|
|
923
963
|
console.log(' ✓ Test 9: Cross-dimension independence');
|
|
924
964
|
}
|
|
925
965
|
|
|
966
|
+
// TEST029: Test matching semantics - direction mismatch in/out does not match
|
|
926
967
|
function testMatchingSemantics_Test10_DirectionMismatch() {
|
|
927
968
|
console.log('Testing Matching Semantics Test 10: Direction mismatch...');
|
|
928
969
|
// Test 10: Direction mismatch (in/out must match)
|
|
@@ -967,6 +1008,7 @@ function makeCap(urnString, title) {
|
|
|
967
1008
|
return new Cap(capUrn, title, 'test', title);
|
|
968
1009
|
}
|
|
969
1010
|
|
|
1011
|
+
// TEST117: Test CapCube finds more specific cap across registries
|
|
970
1012
|
function testCapCubeMoreSpecificWins() {
|
|
971
1013
|
console.log('Testing CapCube: More specific wins...');
|
|
972
1014
|
|
|
@@ -1005,6 +1047,7 @@ function testCapCubeMoreSpecificWins() {
|
|
|
1005
1047
|
console.log(' ✓ More specific wins');
|
|
1006
1048
|
}
|
|
1007
1049
|
|
|
1050
|
+
// TEST118: Test CapCube tie-breaking prefers first registry in order
|
|
1008
1051
|
function testCapCubeTieGoesToFirst() {
|
|
1009
1052
|
console.log('Testing CapCube: Tie goes to first...');
|
|
1010
1053
|
|
|
@@ -1032,6 +1075,7 @@ function testCapCubeTieGoesToFirst() {
|
|
|
1032
1075
|
console.log(' ✓ Tie goes to first');
|
|
1033
1076
|
}
|
|
1034
1077
|
|
|
1078
|
+
// TEST119: Test CapCube polls all registries to find best match
|
|
1035
1079
|
function testCapCubePollsAll() {
|
|
1036
1080
|
console.log('Testing CapCube: Polls all registries...');
|
|
1037
1081
|
|
|
@@ -1066,6 +1110,7 @@ function testCapCubePollsAll() {
|
|
|
1066
1110
|
console.log(' ✓ Polls all registries');
|
|
1067
1111
|
}
|
|
1068
1112
|
|
|
1113
|
+
// TEST120: Test CapCube returns error when no cap matches request
|
|
1069
1114
|
function testCapCubeNoMatch() {
|
|
1070
1115
|
console.log('Testing CapCube: No match error...');
|
|
1071
1116
|
|
|
@@ -1084,6 +1129,7 @@ function testCapCubeNoMatch() {
|
|
|
1084
1129
|
console.log(' ✓ No match error');
|
|
1085
1130
|
}
|
|
1086
1131
|
|
|
1132
|
+
// TEST121: Test CapCube fallback scenario where generic cap handles unknown file types
|
|
1087
1133
|
function testCapCubeFallbackScenario() {
|
|
1088
1134
|
console.log('Testing CapCube: Fallback scenario...');
|
|
1089
1135
|
|
|
@@ -1128,6 +1174,7 @@ function testCapCubeFallbackScenario() {
|
|
|
1128
1174
|
console.log(' ✓ Fallback scenario');
|
|
1129
1175
|
}
|
|
1130
1176
|
|
|
1177
|
+
// TEST122: Test CapCube can method returns execution info and canHandle checks capability
|
|
1131
1178
|
function testCapCubeCanMethod() {
|
|
1132
1179
|
console.log('Testing CapCube: can() method...');
|
|
1133
1180
|
|
|
@@ -1152,6 +1199,7 @@ function testCapCubeCanMethod() {
|
|
|
1152
1199
|
console.log(' ✓ can() method');
|
|
1153
1200
|
}
|
|
1154
1201
|
|
|
1202
|
+
// TEST123: Test CapCube registry management add, get, remove operations
|
|
1155
1203
|
function testCapCubeRegistryManagement() {
|
|
1156
1204
|
console.log('Testing CapCube: Registry management...');
|
|
1157
1205
|
|
|
@@ -1193,6 +1241,7 @@ function makeGraphCap(inUrn, outUrn, title) {
|
|
|
1193
1241
|
return new Cap(capUrn, title, 'convert', title);
|
|
1194
1242
|
}
|
|
1195
1243
|
|
|
1244
|
+
// TEST124: Test CapGraph basic construction builds nodes and edges from caps
|
|
1196
1245
|
function testCapGraphBasicConstruction() {
|
|
1197
1246
|
console.log('Testing CapGraph: Basic construction...');
|
|
1198
1247
|
|
|
@@ -1226,6 +1275,7 @@ function testCapGraphBasicConstruction() {
|
|
|
1226
1275
|
console.log(' ✓ Basic construction');
|
|
1227
1276
|
}
|
|
1228
1277
|
|
|
1278
|
+
// TEST125: Test CapGraph getOutgoing and getIncoming return correct edges for media URN
|
|
1229
1279
|
function testCapGraphOutgoingIncoming() {
|
|
1230
1280
|
console.log('Testing CapGraph: Outgoing and incoming edges...');
|
|
1231
1281
|
|
|
@@ -1258,6 +1308,7 @@ function testCapGraphOutgoingIncoming() {
|
|
|
1258
1308
|
console.log(' ✓ Outgoing and incoming edges');
|
|
1259
1309
|
}
|
|
1260
1310
|
|
|
1311
|
+
// TEST126: Test CapGraph canConvert checks direct and transitive conversion paths
|
|
1261
1312
|
function testCapGraphCanConvert() {
|
|
1262
1313
|
console.log('Testing CapGraph: Can convert...');
|
|
1263
1314
|
|
|
@@ -1292,6 +1343,7 @@ function testCapGraphCanConvert() {
|
|
|
1292
1343
|
console.log(' ✓ Can convert');
|
|
1293
1344
|
}
|
|
1294
1345
|
|
|
1346
|
+
// TEST127: Test CapGraph findPath returns shortest path between media URNs
|
|
1295
1347
|
function testCapGraphFindPath() {
|
|
1296
1348
|
console.log('Testing CapGraph: Find path...');
|
|
1297
1349
|
|
|
@@ -1333,6 +1385,7 @@ function testCapGraphFindPath() {
|
|
|
1333
1385
|
console.log(' ✓ Find path');
|
|
1334
1386
|
}
|
|
1335
1387
|
|
|
1388
|
+
// TEST128: Test CapGraph findAllPaths returns all paths sorted by length
|
|
1336
1389
|
function testCapGraphFindAllPaths() {
|
|
1337
1390
|
console.log('Testing CapGraph: Find all paths...');
|
|
1338
1391
|
|
|
@@ -1364,6 +1417,7 @@ function testCapGraphFindAllPaths() {
|
|
|
1364
1417
|
console.log(' ✓ Find all paths');
|
|
1365
1418
|
}
|
|
1366
1419
|
|
|
1420
|
+
// TEST129: Test CapGraph getDirectEdges returns edges sorted by specificity
|
|
1367
1421
|
function testCapGraphGetDirectEdges() {
|
|
1368
1422
|
console.log('Testing CapGraph: Get direct edges...');
|
|
1369
1423
|
|
|
@@ -1400,6 +1454,7 @@ function testCapGraphGetDirectEdges() {
|
|
|
1400
1454
|
console.log(' ✓ Get direct edges');
|
|
1401
1455
|
}
|
|
1402
1456
|
|
|
1457
|
+
// TEST130: Test CapGraph stats returns node count, edge count, input/output URN counts
|
|
1403
1458
|
function testCapGraphStats() {
|
|
1404
1459
|
console.log('Testing CapGraph: Stats...');
|
|
1405
1460
|
|
|
@@ -1435,6 +1490,7 @@ function testCapGraphStats() {
|
|
|
1435
1490
|
console.log(' ✓ Stats');
|
|
1436
1491
|
}
|
|
1437
1492
|
|
|
1493
|
+
// TEST131: Test CapGraph with CapCube builds graph from multiple registries
|
|
1438
1494
|
function testCapGraphWithCapCube() {
|
|
1439
1495
|
console.log('Testing CapGraph: With CapCube...');
|
|
1440
1496
|
|
|
@@ -1476,6 +1532,7 @@ function testCapGraphWithCapCube() {
|
|
|
1476
1532
|
// StdinSource Tests
|
|
1477
1533
|
// ============================================================================
|
|
1478
1534
|
|
|
1535
|
+
// TEST156: Test creating StdinSource Data variant with byte vector
|
|
1479
1536
|
function testStdinSourceFromData() {
|
|
1480
1537
|
console.log('Testing StdinSource: From data...');
|
|
1481
1538
|
|
|
@@ -1491,6 +1548,7 @@ function testStdinSourceFromData() {
|
|
|
1491
1548
|
console.log(' ✓ From data');
|
|
1492
1549
|
}
|
|
1493
1550
|
|
|
1551
|
+
// TEST157: Test creating StdinSource FileReference variant with all required fields
|
|
1494
1552
|
function testStdinSourceFromFileReference() {
|
|
1495
1553
|
console.log('Testing StdinSource: From file reference...');
|
|
1496
1554
|
|
|
@@ -1513,6 +1571,7 @@ function testStdinSourceFromFileReference() {
|
|
|
1513
1571
|
console.log(' ✓ From file reference');
|
|
1514
1572
|
}
|
|
1515
1573
|
|
|
1574
|
+
// TEST158: Test StdinSource Data with empty vector stores and retrieves correctly
|
|
1516
1575
|
function testStdinSourceWithEmptyData() {
|
|
1517
1576
|
console.log('Testing StdinSource: With empty data...');
|
|
1518
1577
|
|
|
@@ -1526,6 +1585,7 @@ function testStdinSourceWithEmptyData() {
|
|
|
1526
1585
|
console.log(' ✓ With empty data');
|
|
1527
1586
|
}
|
|
1528
1587
|
|
|
1588
|
+
// TEST030: Test StdinSource with null data creates valid Data source
|
|
1529
1589
|
function testStdinSourceWithNullData() {
|
|
1530
1590
|
console.log('Testing StdinSource: With null data...');
|
|
1531
1591
|
|
|
@@ -1538,6 +1598,7 @@ function testStdinSourceWithNullData() {
|
|
|
1538
1598
|
console.log(' ✓ With null data');
|
|
1539
1599
|
}
|
|
1540
1600
|
|
|
1601
|
+
// TEST159: Test StdinSource Data with binary content like PNG header bytes
|
|
1541
1602
|
function testStdinSourceWithBinaryContent() {
|
|
1542
1603
|
console.log('Testing StdinSource: With binary content...');
|
|
1543
1604
|
|
|
@@ -1554,6 +1615,7 @@ function testStdinSourceWithBinaryContent() {
|
|
|
1554
1615
|
console.log(' ✓ With binary content');
|
|
1555
1616
|
}
|
|
1556
1617
|
|
|
1618
|
+
// TEST031: Test StdinSourceKind constants are defined and distinct
|
|
1557
1619
|
function testStdinSourceKindConstants() {
|
|
1558
1620
|
console.log('Testing StdinSource: Kind constants...');
|
|
1559
1621
|
|
|
@@ -1564,6 +1626,7 @@ function testStdinSourceKindConstants() {
|
|
|
1564
1626
|
console.log(' ✓ Kind constants');
|
|
1565
1627
|
}
|
|
1566
1628
|
|
|
1629
|
+
// TEST032: Test StdinSource Data is passed correctly to executeCap
|
|
1567
1630
|
function testStdinSourcePassedToExecuteCap() {
|
|
1568
1631
|
console.log('Testing StdinSource: Passed to executeCap...');
|
|
1569
1632
|
|
|
@@ -1608,6 +1671,7 @@ function testStdinSourcePassedToExecuteCap() {
|
|
|
1608
1671
|
});
|
|
1609
1672
|
}
|
|
1610
1673
|
|
|
1674
|
+
// TEST033: Test StdinSource FileReference is passed correctly to executeCap
|
|
1611
1675
|
function testStdinSourceFileReferencePassedToExecuteCap() {
|
|
1612
1676
|
console.log('Testing StdinSource: File reference passed to executeCap...');
|
|
1613
1677
|
|
|
@@ -1665,7 +1729,7 @@ function testStdinSourceFileReferencePassedToExecuteCap() {
|
|
|
1665
1729
|
// TEST054-056: Validate that inline media_specs don't redefine registry specs
|
|
1666
1730
|
// ============================================================================
|
|
1667
1731
|
|
|
1668
|
-
// TEST054: XV5
|
|
1732
|
+
// TEST054: Test XV5 validation detects inline media spec redefinition of built-in spec
|
|
1669
1733
|
function testXV5InlineSpecRedefinitionDetected() {
|
|
1670
1734
|
console.log('Testing XV5: Inline spec redefinition detected...');
|
|
1671
1735
|
|
|
@@ -1687,7 +1751,7 @@ function testXV5InlineSpecRedefinitionDetected() {
|
|
|
1687
1751
|
console.log(' ✓ Inline spec redefinition detected');
|
|
1688
1752
|
}
|
|
1689
1753
|
|
|
1690
|
-
// TEST055: XV5
|
|
1754
|
+
// TEST055: Test XV5 validation allows new inline media spec not in built-ins
|
|
1691
1755
|
function testXV5NewInlineSpecAllowed() {
|
|
1692
1756
|
console.log('Testing XV5: New inline spec allowed...');
|
|
1693
1757
|
|
|
@@ -1708,7 +1772,7 @@ function testXV5NewInlineSpecAllowed() {
|
|
|
1708
1772
|
console.log(' ✓ New inline spec allowed');
|
|
1709
1773
|
}
|
|
1710
1774
|
|
|
1711
|
-
// TEST056:
|
|
1775
|
+
// TEST056: Test XV5 validation passes for empty or null media_specs
|
|
1712
1776
|
function testXV5EmptyMediaSpecsAllowed() {
|
|
1713
1777
|
console.log('Testing XV5: Empty media_specs allowed...');
|
|
1714
1778
|
|
package/package.json
CHANGED