@@ -612,6 +612,76 @@ describe('ContextConstructor', () => {
612612 } ) ;
613613 } ) ;
614614
615+ it ( 'should handle non-empty component definitions for JSON ranges in arrays' , ( ) => {
616+ expect ( ctor . constructComponentShortcuts ( {
617+ '/docs/package/components/file1' : {
618+ '@context' : [
619+ 'https://linkedsoftwaredependencies.org/bundles/npm/my-package/context.jsonld' ,
620+ ] ,
621+ '@id' : 'npmd:my-package' ,
622+ components : [
623+ {
624+ '@id' : 'mp:file1#MyClass1' ,
625+ '@type' : 'Class' ,
626+ constructorArguments : [ ] ,
627+ parameters : [
628+ {
629+ '@id' : 'mp:file1#MyClass1_param1' ,
630+ range : {
631+ '@type' : 'ParameterRangeArray' ,
632+ parameterRangeValue : 'rdf:JSON' ,
633+ } ,
634+ } ,
635+ {
636+ '@id' : 'mp:file1#MyClass1_param2' ,
637+ range : 'rdf:JSON' ,
638+ } ,
639+ ] ,
640+ memberFields : [ ] ,
641+ requireElement : 'MyClass1' ,
642+ } ,
643+ ] ,
644+ } ,
645+ '/docs/package/components/b/file2' : {
646+ '@context' : [
647+ 'https://linkedsoftwaredependencies.org/bundles/npm/my-package/context.jsonld' ,
648+ ] ,
649+ '@id' : 'npmd:my-package' ,
650+ components : [
651+ {
652+ '@id' : 'mp:b/file2#MyClass2' ,
653+ '@type' : 'Class' ,
654+ requireElement : 'MyClass2' ,
655+ constructorArguments : [ ] ,
656+ parameters : [ ] ,
657+ memberFields : [ ] ,
658+ } ,
659+ ] ,
660+ } ,
661+ } ) ) . toEqual ( {
662+ MyClass1 : {
663+ '@id' : 'mp:file1#MyClass1' ,
664+ '@prefix' : true ,
665+ '@context' : {
666+ param1 : {
667+ '@id' : 'mp:file1#MyClass1_param1' ,
668+ '@type' : '@json' ,
669+ '@container' : '@list' ,
670+ } ,
671+ param2 : {
672+ '@id' : 'mp:file1#MyClass1_param2' ,
673+ '@type' : '@json' ,
674+ } ,
675+ } ,
676+ } ,
677+ MyClass2 : {
678+ '@id' : 'mp:b/file2#MyClass2' ,
679+ '@prefix' : true ,
680+ '@context' : { } ,
681+ } ,
682+ } ) ;
683+ } ) ;
684+
615685 it ( 'should handle non-empty component definitions when typeScopedContexts is true for opt arrays' , ( ) => {
616686 ctor = new ContextConstructor ( {
617687 packageMetadata,
0 commit comments