diff --git a/test/Schema.spec.ts b/test/Schema.spec.ts index 48a5e9d8..77dc3ab4 100644 --- a/test/Schema.spec.ts +++ b/test/Schema.spec.ts @@ -193,7 +193,7 @@ export class SchemaSpec { continue; } - const type = property.type!; + let type = property.type!; if (isIntrinsicType(type)) { continue; @@ -212,10 +212,24 @@ export class SchemaSpec { fail(`'${thingName}'#'${property.name}' element type '${elementType.type}' is not handled by this test!`); } } else if (isReferenceType(type)) { - expect(SchemaSpec.thingNames).not.to.contain( - type.name, - `Property '${property.name}' on type '${thingName}' has element type '${type.name}'.`, - ); + do { + expect(SchemaSpec.thingNames).not.to.contain( + type.name, + `Property '${property.name}' on type '${thingName}' has element type '${type.name}'.`, + ); + + const referencedObject = SchemaSpec.objects[type.name]; + if (typeof referencedObject !== 'undefined') { + const referencedType = referencedObject.type; + if (typeof referencedType !== 'undefined') { + type = referencedType; + } else { + break; + } + } else { + break; + } + } while (isReferenceType(type)); } else if (isUnionType(type)) { for (const nestedType of type.types) { if (isIntrinsicType(nestedType) || isStringLiteralType(nestedType)) {