Fix email recipient comparison (#1184)

## Description

M365 overrides recipient names if the email is known so don't compare that while checking.

Similar updates will likely be needed for other fields like [B]CC in the future.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

* closes #1183 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2022-10-17 14:13:11 -07:00 committed by GitHub
parent a32f86e40d
commit 8c495f8866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,6 +193,17 @@ func attachmentEqual(
return true return true
} }
func recipientEqual(
expected models.Recipientable,
got models.Recipientable,
) bool {
// Don't compare names as M365 will override the name if the address is known.
return emptyOrEqual(
expected.GetEmailAddress().GetAddress(),
got.GetEmailAddress().GetAddress(),
)
}
func checkMessage( func checkMessage(
t *testing.T, t *testing.T,
expected models.Messageable, expected models.Messageable,
@ -265,7 +276,7 @@ func checkMessage(
testEmptyOrEqual(t, expected.GetSubject(), got.GetSubject(), "Subject") testEmptyOrEqual(t, expected.GetSubject(), got.GetSubject(), "Subject")
assert.Equal(t, expected.GetToRecipients(), got.GetToRecipients(), "ToRecipients") testElementsMatch(t, expected.GetToRecipients(), got.GetToRecipients(), recipientEqual)
// Skip WebLink as it's tied to this specific instance of the item. // Skip WebLink as it's tied to this specific instance of the item.