Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/specs/integration/BaseEntity/SubqueriesSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ component extends="tests.resources.ModuleIntegrationSpec" {
);
} );

it( "keeps scoped subselects when retrieving all entities", function() {
var users = getInstance( "User" ).withLatestPostId().all();

expect( users ).toHaveLength( 5 );
expect( users[ 1 ].getLatestPostId() ).toBe( 523526 );
expect( variables.queries ).toHaveLength(
1,
"Only one query should have been executed. #arrayLen( variables.queries )# were instead."
);
} );

it( "can add a subquery to an entity using a relationship", function() {
var elpete = getInstance( "User" ).withLatestPostIdRelationship().findOrFail( 1 );
expect( elpete.getLatestPostId() ).notToBeNull();
Expand Down
Loading