Skip to content

Commit 8bcf976

Browse files
committed
Fix cross-engine spec syntax and relationship metadata detection
1 parent ee24b38 commit 8bcf976

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

models/BaseEntity.cfc

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,13 +2791,30 @@ component accessors="true" {
27912791
}
27922792
}
27932793

2794+
var baseEntityFunctionNames = variables._cache.getOrSet( "quick-metadata:BaseEntity", function() {
2795+
return arrayReduce(
2796+
getComponentMetadata( "quick.models.BaseEntity" ).functions,
2797+
function( acc, func ) {
2798+
arguments.acc[ arguments.func.name ] = "";
2799+
return arguments.acc;
2800+
},
2801+
{}
2802+
);
2803+
} );
27942804
var functionsForRelationshipDetection = [];
2795-
if ( meta.localMetadata.keyExists( "functions" ) && isArray( meta.localMetadata.functions ) ) {
2796-
functionsForRelationshipDetection = meta.localMetadata.functions;
2797-
} else if ( meta.originalMetadata.keyExists( "functions" ) && isArray( meta.originalMetadata.functions ) ) {
2805+
if (
2806+
meta.originalMetadata.keyExists( "functions" ) &&
2807+
isArray( meta.originalMetadata.functions ) &&
2808+
!meta.originalMetadata.functions.isEmpty()
2809+
) {
27982810
functionsForRelationshipDetection = meta.originalMetadata.functions;
2811+
} else if ( meta.localMetadata.keyExists( "functions" ) && isArray( meta.localMetadata.functions ) ) {
2812+
functionsForRelationshipDetection = meta.localMetadata.functions;
27992813
}
2800-
meta[ "functionNames" ] = generateFunctionNameArray( from = functionsForRelationshipDetection );
2814+
meta[ "functionNames" ] = generateFunctionNameArray(
2815+
from = functionsForRelationshipDetection,
2816+
without = baseEntityFunctionNames
2817+
);
28012818

28022819
param meta.originalMetadata.properties = [];
28032820

tests/specs/integration/BaseEntity/MetadataSpec.cfc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ component extends="tests.resources.ModuleIntegrationSpec" {
9797

9898
describe( "boxlang metadata compatibility", function() {
9999
it(
100-
"can read accessors metadata from annotations",
101-
function() {
100+
title = "can read accessors metadata from annotations",
101+
body = function() {
102102
expect( function() {
103103
getInstance( "User" );
104104
} ).notToThrow();
@@ -107,8 +107,8 @@ component extends="tests.resources.ModuleIntegrationSpec" {
107107
);
108108

109109
it(
110-
"can read property persistent metadata from annotations",
111-
function() {
110+
title = "can read property persistent metadata from annotations",
111+
body = function() {
112112
var link = getInstance( "Link" );
113113
expect( link.get_Attributes() ).notToHaveKey( "wirebox" );
114114
},

0 commit comments

Comments
 (0)