@@ -691,11 +691,13 @@ describe('Entity mutation hooks tests', () => {
691691 await expect ( client . user . findMany ( ) ) . toResolveWithLength ( 0 ) ;
692692 } ) ;
693693 } ) ;
694+ } ) ;
694695
695- describe ( 'Delegate model interaction' , ( ) => {
696- it ( 'update on child model succeeds with afterEntityMutation plugin' , async ( ) => {
697- const client = await createTestClient (
698- `
696+ describe ( 'Entity mutation hooks - delegate model interaction' , ( ) => {
697+ it ( 'update on child model succeeds with afterEntityMutation plugin' , async ( ) => {
698+ console . log ( 'RUNNING!!!!' ) ;
699+ const client = await createTestClient (
700+ `
699701model Base {
700702 id Int @id @default(autoincrement())
701703 orgId Int
@@ -707,29 +709,28 @@ model Child extends Base {
707709 childField Int
708710}
709711` ,
710- ) ;
712+ ) ;
711713
712- const withPlugin = client . $use ( {
713- id : 'test' ,
714- onEntityMutation : {
715- afterEntityMutation ( ) { } ,
716- } ,
717- } ) ;
714+ const withPlugin = client . $use ( {
715+ id : 'test' ,
716+ onEntityMutation : {
717+ afterEntityMutation ( ) { } ,
718+ } ,
719+ } ) ;
718720
719- const created = await withPlugin . child . create ( {
720- data : { orgId : 1 , childField : 10 } ,
721- } ) ;
721+ const created = await withPlugin . child . create ( {
722+ data : { orgId : 1 , childField : 10 } ,
723+ } ) ;
722724
723- const updated = await withPlugin . child . update ( {
724- where : { id : created . id } ,
725- data : { orgId : 2 , childField : 20 } ,
726- } ) ;
725+ const updated = await withPlugin . child . update ( {
726+ where : { id : created . id } ,
727+ data : { orgId : 2 , childField : 20 } ,
728+ } ) ;
727729
728- expect ( updated ) . toBeTruthy ( ) ;
729- expect ( updated . orgId ) . toBe ( 2 ) ;
730- expect ( updated . childField ) . toBe ( 20 ) ;
730+ expect ( updated ) . toBeTruthy ( ) ;
731+ expect ( updated . orgId ) . toBe ( 2 ) ;
732+ expect ( updated . childField ) . toBe ( 20 ) ;
731733
732- await client . $disconnect ( ) ;
733- } ) ;
734+ await client . $disconnect ( ) ;
734735 } ) ;
735736} ) ;
0 commit comments