@@ -277,7 +277,11 @@ class AssetInterfaceDescriptionUtilTest {
277277 . to . have . property ( "value" )
278278 . to . be . an ( "array" )
279279 . to . have . lengthOf . greaterThan ( 0 ) ;
280- expect ( endpointMetadataValue . value [ 0 ] . value ) . to . equal ( "nosec_sc" ) ;
280+ expect ( endpointMetadataValue . value [ 0 ] ) . to . have . property ( "value" ) ;
281+ const modelReferenceValue = endpointMetadataValue . value [ 0 ] . value ;
282+ expect ( modelReferenceValue ) . to . have . property ( "type" ) . to . equal ( "ModelReference" ) ;
283+ expect ( modelReferenceValue ) . to . have . property ( "keys" ) . to . be . an ( "array" ) . to . have . lengthOf ( 5 ) ;
284+ expect ( modelReferenceValue . keys [ 4 ] ) . to . have . property ( "value" ) . to . equal ( "nosec_sc" ) ;
281285 } else if ( endpointMetadataValue . idShort === "securityDefinitions" ) {
282286 hasSecurityDefinitions = true ;
283287 expect ( endpointMetadataValue )
@@ -472,6 +476,7 @@ class AssetInterfaceDescriptionUtilTest {
472476 td1 : ThingDescription = {
473477 "@context" : "https://www.w3.org/2022/wot/td/v1.1" ,
474478 title : "testTD" ,
479+ id : "urn:uuid:0804d572-cce8-422a-bb7c-4412fcd56f03" ,
475480 securityDefinitions : {
476481 basic_sc : {
477482 scheme : "basic" ,
@@ -517,9 +522,11 @@ class AssetInterfaceDescriptionUtilTest {
517522
518523 const smObj = JSON . parse ( sm ) ;
519524 expect ( smObj ) . to . have . property ( "idShort" ) . that . equals ( "AssetInterfacesDescription" ) ;
525+ expect ( smObj ) . to . have . property ( "id" ) ;
520526 expect ( smObj ) . to . have . property ( "semanticId" ) ;
521527 expect ( smObj ) . to . have . property ( "submodelElements" ) . to . be . an ( "array" ) . to . have . lengthOf . greaterThan ( 0 ) ;
522528 const smInterface = smObj . submodelElements [ 0 ] ;
529+ expect ( smInterface ) . to . have . property ( "idShort" ) ;
523530 expect ( smInterface ) . to . have . property ( "value" ) . to . be . an ( "array" ) . to . have . lengthOf . greaterThan ( 0 ) ;
524531 expect ( smInterface )
525532 . to . have . property ( "semanticId" )
@@ -557,7 +564,28 @@ class AssetInterfaceDescriptionUtilTest {
557564 . to . have . property ( "value" )
558565 . to . be . an ( "array" )
559566 . to . have . lengthOf . greaterThan ( 0 ) ;
560- expect ( endpointMetadataValue . value [ 0 ] . value ) . to . equal ( "basic_sc" ) ;
567+ expect ( endpointMetadataValue . value [ 0 ] ) . to . have . property ( "value" ) ;
568+ const modelReferenceValue = endpointMetadataValue . value [ 0 ] . value ;
569+ expect ( modelReferenceValue ) . to . have . property ( "type" ) . to . equal ( "ModelReference" ) ;
570+ expect ( modelReferenceValue ) . to . have . property ( "keys" ) . to . be . an ( "array" ) . to . have . lengthOf ( 5 ) ;
571+ expect ( modelReferenceValue . keys [ 0 ] ) . to . have . property ( "type" ) . to . equal ( "Submodel" ) ;
572+ expect ( modelReferenceValue . keys [ 0 ] ) . to . have . property ( "value" ) . to . equal ( smObj . id ) ;
573+ expect ( modelReferenceValue . keys [ 1 ] )
574+ . to . have . property ( "type" )
575+ . to . equal ( "SubmodelElementCollection" ) ;
576+ expect ( modelReferenceValue . keys [ 1 ] ) . to . have . property ( "value" ) . to . equal ( smInterface . idShort ) ;
577+ expect ( modelReferenceValue . keys [ 2 ] )
578+ . to . have . property ( "type" )
579+ . to . equal ( "SubmodelElementCollection" ) ;
580+ expect ( modelReferenceValue . keys [ 2 ] ) . to . have . property ( "value" ) . to . equal ( "EndpointMetadata" ) ;
581+ expect ( modelReferenceValue . keys [ 3 ] )
582+ . to . have . property ( "type" )
583+ . to . equal ( "SubmodelElementCollection" ) ;
584+ expect ( modelReferenceValue . keys [ 3 ] ) . to . have . property ( "value" ) . to . equal ( "securityDefinitions" ) ;
585+ expect ( modelReferenceValue . keys [ 4 ] )
586+ . to . have . property ( "type" )
587+ . to . equal ( "SubmodelElementCollection" ) ;
588+ expect ( modelReferenceValue . keys [ 4 ] ) . to . have . property ( "value" ) . to . equal ( "basic_sc" ) ;
561589 } else if ( endpointMetadataValue . idShort === "securityDefinitions" ) {
562590 hasSecurityDefinitions = true ;
563591 expect ( endpointMetadataValue )
@@ -725,11 +753,9 @@ class AssetInterfaceDescriptionUtilTest {
725753 expect ( hasInterfaceMetadata , "No InterfaceMetadata" ) . to . equal ( true ) ;
726754
727755 // Test to use all possible prefixes -> in this case it is only https
756+ // Note: id is autogenerated (if not present) -> needs to be exluded/removed/set in TD
728757 const sm2 = this . assetInterfaceDescriptionUtil . transformTD2SM ( JSON . stringify ( this . td1 ) ) ;
729758 const sm2Obj = JSON . parse ( sm2 ) ;
730- // Note: id is autogenerated and needs to be exluded/removed
731- delete smObj . id ;
732- delete sm2Obj . id ;
733759 expect ( smObj ) . to . eql ( sm2Obj ) ;
734760 }
735761
@@ -837,7 +863,11 @@ class AssetInterfaceDescriptionUtilTest {
837863 . to . have . property ( "value" )
838864 . to . be . an ( "array" )
839865 . to . have . lengthOf . greaterThan ( 0 ) ;
840- expect ( endpointMetadataValue . value [ 0 ] . value ) . to . equal ( "nosec_sc" ) ;
866+ expect ( endpointMetadataValue . value [ 0 ] ) . to . have . property ( "value" ) ;
867+ const modelReferenceValue = endpointMetadataValue . value [ 0 ] . value ;
868+ expect ( modelReferenceValue ) . to . have . property ( "type" ) . to . equal ( "ModelReference" ) ;
869+ expect ( modelReferenceValue ) . to . have . property ( "keys" ) . to . be . an ( "array" ) . to . have . lengthOf ( 5 ) ;
870+ expect ( modelReferenceValue . keys [ 4 ] ) . to . have . property ( "value" ) . to . equal ( "nosec_sc" ) ;
841871 } else if ( endpointMetadataValue . idShort === "securityDefinitions" ) {
842872 hasSecurityDefinitions = true ;
843873 }
0 commit comments