Skip to content

Commit

Permalink
Merge pull request #159 from zspitzer/TESTBOX-408
Browse files Browse the repository at this point in the history
TESTBOX-408 Allow toHaveKey to support struct like objects
  • Loading branch information
lmajano authored Dec 16, 2024
2 parents ba5911c + e703986 commit a39276e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions system/Assertion.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -1454,16 +1454,13 @@ component {
* @throws InvalidTargetType - If we can normalize it to a struct
*/
private function normalizeToStruct( any target ){
if ( isStruct( arguments.target ) ) {
return arguments.target;
}
if ( isQuery( arguments.target ) ) {
return getMetadata( arguments.target ).reduce( ( results, item ) => {
results[ item.name ] = {};
return results;
}, {} );
}
throw( "InvalidTargetType", "The target is not a struct or query" );
return arguments.target;
}

}

0 comments on commit a39276e

Please sign in to comment.