@@ -21,7 +21,8 @@ public class ConvNoteCacheFilterHelperTest {
21
21
22
22
Test .startTest ();
23
23
Set <Id > result = ConvNoteCacheFilterHelper .getRecordIdsRequiringCacheClear (
24
- convNotes
24
+ convNotes ,
25
+ false // record is created
25
26
);
26
27
Test .stopTest ();
27
28
@@ -68,13 +69,60 @@ public class ConvNoteCacheFilterHelperTest {
68
69
69
70
Test .startTest ();
70
71
Set <Id > result = ConvNoteCacheFilterHelper .getRecordIdsRequiringCacheClear (
71
- convNotes
72
+ convNotes ,
73
+ false // record is created
72
74
);
73
75
Test .stopTest ();
74
76
75
77
Assert .areEqual (0 , result .size ());
76
78
}
77
79
80
+ @IsTest
81
+ static void shouldReturnOneRecordIdForConvNoteUpdatedByModiaIntegrationUser () {
82
+ myTriggers .disable (ConvNoteCacheHandler .class );
83
+
84
+ Id profileId = [
85
+ SELECT Id
86
+ FROM Profile
87
+ WHERE Name = ' System Administrator'
88
+ LIMIT 1
89
+ ]
90
+ .Id ;
91
+ User modiaIntegrationUser = (User ) SharedTestDataFactory .createRecord (
92
+ new User (
93
+
94
+ ProfileId = profileId
95
+ )
96
+ );
97
+
98
+ Account personAccount = SharedTestDataFactory .createPersonAccount ();
99
+
100
+ System .runAs (modiaIntegrationUser ) {
101
+ SharedTestDataFactory .createRecord (
102
+ new Conversation_Note__c (
103
+ CRM_Account__c = personAccount .Id ,
104
+ CRM_Conversation_Note__c = ' DUMMY TEXT' ,
105
+ CRM_Henvendelse_BehandlingskjedeId__c = ' 789'
106
+ )
107
+ );
108
+ }
109
+
110
+ List <Conversation_Note__c > convNotes = [
111
+ SELECT Id , LastModifiedById
112
+ FROM Conversation_Note__c
113
+ WHERE CRM_Henvendelse_BehandlingskjedeId__c = ' 789'
114
+ ];
115
+
116
+ Test .startTest ();
117
+ Set <Id > result = ConvNoteCacheFilterHelper .getRecordIdsRequiringCacheClear (
118
+ convNotes ,
119
+ true // record is updated
120
+ );
121
+ Test .stopTest ();
122
+
123
+ Assert .areEqual (1 , result .size ());
124
+ }
125
+
78
126
@IsTest
79
127
static void shouldReturnOneActorIdWhenOneConversationNoteId () {
80
128
myTriggers .disable (ConvNoteCacheHandler .class );
0 commit comments