Skip to content

Commit 0a88a8f

Browse files
dab246hoangdat
authored andcommitted
TF-4404 Keep automation keys stable across enum renames.
1 parent b97abfb commit 0a88a8f

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

integration_test/scenarios/calendar/mail_to_attendees_event_email_scenario.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class MailToAttendeesEventEmailScenario extends BaseTestScenario
1717
with OpenCalendarEventScenarioMixin {
1818
const MailToAttendeesEventEmailScenario(super.$);
1919

20+
static const _expectedEventTitle = 'Come for a chat';
21+
2022
@override
2123
Future<void> runTestLogic() async {
2224
final threadRobot = ThreadRobot($);
@@ -51,7 +53,7 @@ class MailToAttendeesEventEmailScenario extends BaseTestScenario
5153
final actualSubject = composerController.subjectEmail.value ?? '';
5254

5355
final expectedSubject = EmailUtils.applyPrefix(
54-
subject: 'Come for a chat',
56+
subject: _expectedEventTitle,
5557
defaultPrefix: EmailUtils.defaultReplyPrefix,
5658
localizedPrefix: appLocalizations.prefix_reply_email,
5759
);

lib/features/email/domain/model/event_action.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,20 @@ enum EventActionType {
2424
}
2525
}
2626

27-
Key getKeyButton() => Key('${name}_event_action_button');
27+
Key getKeyButton() {
28+
switch (this) {
29+
case EventActionType.yes:
30+
return const Key('yes_event_action_button');
31+
case EventActionType.acceptCounter:
32+
return const Key('acceptCounter_event_action_button');
33+
case EventActionType.maybe:
34+
return const Key('maybe_event_action_button');
35+
case EventActionType.no:
36+
return const Key('no_event_action_button');
37+
case EventActionType.mailToAttendees:
38+
return const Key('mailToAttendees_event_action_button');
39+
}
40+
}
2841

2942
String getToastMessageSuccess(BuildContext context) {
3043
switch(this) {

test/features/email/presentation/apply_prefix_test.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,19 @@ void main() {
184184
equals(' Re: Hello'),
185185
);
186186
});
187+
188+
test(
189+
'should add a standardized prefix for a legacy NBSP variant',
190+
() {
191+
expect(
192+
EmailUtils.applyPrefix(
193+
subject: 'Re\u00A0: Hello',
194+
defaultPrefix: EmailUtils.defaultReplyPrefix,
195+
),
196+
equals('Re: Re\u00A0: Hello'),
197+
);
198+
},
199+
);
187200
});
188201
});
189202
}

0 commit comments

Comments
 (0)