From dd22106057b0f364dbc3159af4f558b6c580c22b Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sat, 22 Aug 2026 07:18:46 -0600 Subject: [PATCH] test: cover has-many deleteAll bindings Refs #124 --- .../BaseEntity/Relationships/HasManySpec.cfc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc b/tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc index 5d495f74..a35a6832 100644 --- a/tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc +++ b/tests/specs/integration/BaseEntity/Relationships/HasManySpec.cfc @@ -173,6 +173,16 @@ component extends="tests.resources.ModuleIntegrationSpec" { expect( newPost.fresh().getLifecycleEventVar() ).toBeNull(); } ); + it( "deletes related entities using the actual foreign key value", function() { + var user = getInstance( "User" ).findOrFail( 1 ); + expect( user.posts().count() ).toBe( 2 ); + + user.posts().deleteAll(); + + expect( getInstance( "Post" ).where( "user_id", 1 ).count() ).toBe( 0 ); + expect( getInstance( "Post" ).where( "user_id", 4 ).count() ).toBeGT( 0 ); + } ); + it( "can first off of the relationship", function() { var user = getInstance( "User" ).find( 1 ); var post = user.posts().first();