@@ -419,6 +419,7 @@ describe('opportunity-workspace-notifications', () => {
419419 expect ( changes [ 0 ] . opportunityName ) . to . equal ( 'New Opp' ) ;
420420 expect ( changes [ 0 ] . assigneeBefore ) . to . equal ( '' ) ;
421421 expect ( changes [ 0 ] . assigneeAfter ) . to . equal ( 'user@test.com' ) ;
422+ expect ( changes [ 0 ] . statusAfter ) . to . equal ( 'new' ) ;
422423 expect ( changes [ 0 ] . recipients ) . to . include ( 'user@test.com' ) ;
423424 expect ( changes [ 0 ] . recipients ) . to . include ( 'owner@test.com' ) ;
424425 } ) ;
@@ -474,6 +475,7 @@ describe('opportunity-workspace-notifications', () => {
474475 expect ( changes [ 0 ] . type ) . to . equal ( 'assignment' ) ;
475476 expect ( changes [ 0 ] . assigneeBefore ) . to . equal ( '' ) ;
476477 expect ( changes [ 0 ] . assigneeAfter ) . to . equal ( 'user@test.com' ) ;
478+ expect ( changes [ 0 ] . statusAfter ) . to . equal ( 'new' ) ;
477479 } ) ;
478480
479481 it ( 'should emit assignment change when assignee changes from one user to another' , ( ) => {
@@ -505,6 +507,7 @@ describe('opportunity-workspace-notifications', () => {
505507 expect ( changes [ 0 ] . type ) . to . equal ( 'assignment' ) ;
506508 expect ( changes [ 0 ] . assigneeBefore ) . to . equal ( 'user1@test.com' ) ;
507509 expect ( changes [ 0 ] . assigneeAfter ) . to . equal ( 'user2@test.com' ) ;
510+ expect ( changes [ 0 ] . statusAfter ) . to . equal ( 'new' ) ;
508511 } ) ;
509512
510513 it ( 'should not emit assignment change when assignee is removed' , ( ) => {
@@ -567,6 +570,7 @@ describe('opportunity-workspace-notifications', () => {
567570 expect ( statusChange . statusAfter ) . to . equal ( 'completed' ) ;
568571 expect ( assignmentChange . assigneeBefore ) . to . equal ( 'user1@test.com' ) ;
569572 expect ( assignmentChange . assigneeAfter ) . to . equal ( 'user2@test.com' ) ;
573+ expect ( assignmentChange . statusAfter ) . to . equal ( 'completed' ) ;
570574 } ) ;
571575
572576 it ( 'should collect all assignees for strategy status change' , ( ) => {
@@ -809,7 +813,7 @@ describe('opportunity-workspace-notifications', () => {
809813 expect ( emailOptions . templateData . strategy_url ) . to . equal ( 'https://llmo.now/www.example.com/insights/opportunity-workspace' ) ;
810814 } ) ;
811815
812- it ( 'should send assignment change email with llmo_opportunity_assignment template' , async ( ) => {
816+ it ( 'should send assignment change email with llmo_opportunity_status_update template' , async ( ) => {
813817 const changes = [ {
814818 type : 'assignment' ,
815819 strategyId : 's1' ,
@@ -818,6 +822,7 @@ describe('opportunity-workspace-notifications', () => {
818822 opportunityName : 'Opp 1' ,
819823 assigneeBefore : '' ,
820824 assigneeAfter : 'user@test.com' ,
825+ statusAfter : 'new' ,
821826 recipients : [ 'user@test.com' ] ,
822827 createdBy : 'owner@test.com' ,
823828 assignee : 'user@test.com' ,
@@ -830,7 +835,7 @@ describe('opportunity-workspace-notifications', () => {
830835 expect ( summary . sent ) . to . equal ( 1 ) ;
831836 expect ( sendEmailStub ) . to . have . been . calledOnce ;
832837 const [ , emailOptions ] = sendEmailStub . firstCall . args ;
833- expect ( emailOptions . templateName ) . to . equal ( 'llmo_opportunity_assignment ' ) ;
838+ expect ( emailOptions . templateName ) . to . equal ( 'llmo_opportunity_status_update ' ) ;
834839 expect ( emailOptions . recipients ) . to . deep . equal ( [ 'user@test.com' ] ) ;
835840 } ) ;
836841
@@ -843,6 +848,7 @@ describe('opportunity-workspace-notifications', () => {
843848 opportunityName : 'Opp 1' ,
844849 assigneeBefore : 'user1@test.com' ,
845850 assigneeAfter : 'user2@test.com' ,
851+ statusAfter : 'in_progress' ,
846852 recipients : [ 'user2@test.com' ] ,
847853 createdBy : 'owner@test.com' ,
848854 assignee : 'user2@test.com' ,
@@ -860,6 +866,7 @@ describe('opportunity-workspace-notifications', () => {
860866 expect ( emailOptions . templateData . strategy_owner_name ) . to . equal ( 'Owner Smith' ) ;
861867 expect ( emailOptions . templateData . strategy_owner_email ) . to . equal ( 'owner@test.com' ) ;
862868 expect ( emailOptions . templateData . opportunity_name ) . to . equal ( 'Opp 1' ) ;
869+ expect ( emailOptions . templateData . opportunity_status ) . to . equal ( 'in_progress' ) ;
863870 expect ( emailOptions . templateData . strategy_name ) . to . equal ( 'Strategy 1' ) ;
864871 expect ( emailOptions . templateData . strategy_url ) . to . equal ( 'https://llmo.now/www.example.com/insights/opportunity-workspace' ) ;
865872 } ) ;
@@ -873,6 +880,7 @@ describe('opportunity-workspace-notifications', () => {
873880 opportunityName : 'Opp 1' ,
874881 assigneeBefore : '' ,
875882 assigneeAfter : 'user@test.com' ,
883+ statusAfter : 'new' ,
876884 recipients : [ 'user@test.com' ] ,
877885 createdBy : '' ,
878886 assignee : 'user@test.com' ,
0 commit comments