Skip to content

Commit 2ac2dc2

Browse files
committed
chore(tests): Add additional test coverage
1 parent bf5d726 commit 2ac2dc2

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

tests/specs/integration/BaseEntity/ChildClassSpec.cfc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ component extends="tests.resources.ModuleIntegrationSpec" {
426426
expect( comment.hasAttribute( "upperBody" ) ).toBeTrue(
427427
"Child class should have a virtual attribute 'upperBody'."
428428
);
429+
430+
expect( comment.getBody() ).toBeWithCase( "This is an internal comment. It is very, very private." );
431+
expect( comment.getUpperBody() ).toBeWithCase( "THIS IS AN INTERNAL COMMENT. IT IS VERY, VERY PRIVATE." );
429432
} );
430433
} );
431434

tests/specs/integration/BaseEntity/Relationships/QueryingRelationshipsSpec.cfc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,26 @@ component extends="tests.resources.ModuleIntegrationSpec" {
184184
expect( posts ).toHaveLength( 1 );
185185
expect( posts[ 1 ].getAuthor().getId() ).toBe( 4 );
186186
} );
187+
it( "can use whereHas when both nested relationships are belongsToMany", function() {
188+
var posts = getInstance( "Post" )
189+
.whereHas( "tags.posts", function( q ) {
190+
q.where( "post_pk", 1245 );
191+
} )
192+
.get();
193+
194+
expect( posts ).toBeArray();
195+
expect( posts ).notToBeEmpty();
196+
} );
197+
it( "can join after populating a cloned query builder", function() {
198+
var posts = getInstance( "Post" ).newQuery();
199+
posts.populateQuery( posts.getQB().clone() );
200+
201+
expect( function() {
202+
posts.join( "users", function( j ) {
203+
j.on( "users.id", posts.qualifyColumn( "user_id" ) );
204+
} );
205+
} ).notToThrow();
206+
} );
187207
} );
188208

189209
describe( "hasManyThrough", function() {

0 commit comments

Comments
 (0)