Skip to content

Commit

Permalink
fixup! TF-3034 Prevent duplicate draft warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tddang-linagora committed Oct 4, 2024
1 parent f611580 commit f203edd
Showing 1 changed file with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,64 @@ void main() {
expect(ccProps.hashCode, isNot(bccProps.hashCode));
expect(bccProps.hashCode, isNot(toProps.hashCode));
});

test(
'should generate different hashcode '
'when toRecipients is updated',
() {
// arrange
final listToRecipients = {
EmailAddress('to name', 'to email')
};
final savedEmailDraft = SavedEmailDraft(
subject: 'subject',
content: 'content',
toRecipients: listToRecipients,
ccRecipients: {EmailAddress('cc name', 'cc email')},
bccRecipients: {EmailAddress('bcc name', 'bcc email')},
identity: null,
attachments: [],
hasReadReceipt: false
);
final hashCodeBeforeChange = savedEmailDraft.hashCode;

// act
listToRecipients.add(EmailAddress('to name 2', 'to email 2'));
final hashCodeAfterChange = savedEmailDraft.hashCode;

// assert
expect(hashCodeBeforeChange, isNot(hashCodeAfterChange));
});

test(
'should generate same hashcode '
'when all properties are the same',
() {
// arrange
final savedEmailDraft = SavedEmailDraft(
subject: 'subject',
content: 'content',
toRecipients: {EmailAddress('to name', 'to email')},
ccRecipients: {EmailAddress('cc name', 'cc email')},
bccRecipients: {EmailAddress('bcc name', 'bcc email')},
identity: null,
attachments: [],
hasReadReceipt: false
);

final savedEmailDraft2 = SavedEmailDraft(
subject: 'subject',
content: 'content',
toRecipients: {EmailAddress('to name', 'to email')},
ccRecipients: {EmailAddress('cc name', 'cc email')},
bccRecipients: {EmailAddress('bcc name', 'bcc email')},
identity: null,
attachments: [],
hasReadReceipt: false
);

// assert
expect(savedEmailDraft.hashCode, equals(savedEmailDraft2.hashCode));
});
});
}

0 comments on commit f203edd

Please sign in to comment.