Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions Test/public/convertMeetingMembersToMarkdown.test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -248,22 +248,21 @@ function Test_ConvertMeetingsMembersToMarkdown_Big_sample{
- "Kevin Kim" <[email protected]>
- "Laura Lewis" <[email protected]>
- "Mark Martinez" <[email protected]>
- Betasoft (13)
- Betasoft (14)
- "Amy Adams (She/Her)" <[email protected]>
- "Bob Brown" <[email protected]>
- "Charlie Chen" <[email protected]>
- "David Dennis" <[email protected]>
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- "Iris Ingram" <[email protected]>
- "Jack Johnson" <[email protected]>
- "James Jackson" <[email protected]>
- "Jennifer Jones" <[email protected]>
- "Kyle Knight" <[email protected]>
- [email protected]
- Bookings (1)
- [email protected]
- Deltalab (3)
- "Alice Anderson" <[email protected]>
- "Emma Evans, Eric" <[email protected]>
Expand All @@ -272,4 +271,21 @@ function Test_ConvertMeetingsMembersToMarkdown_Big_sample{

Assert-AreEqual -Presented $result -Expected $expected

}

function Test_ConvertMeetingMembersToMarkdown_SubdomainEmailGroupsByRegisteredDomain {

# Arrange
$input = "Alice Johnson <[email protected]>, Bob Smith <[email protected]>"

# Act
$result = Convert-NotesMeetingMembersToMarkdown -MeetingMembers $input

# Assert
$expected = @"
- Contoso (2)
- Alice Johnson <[email protected]>
- Bob Smith <[email protected]>
"@
Assert-AreEqual -Expected $expected -Presented $result -Comment "Subdomain like emea.contoso.com should group under the registered domain (contoso), not the subdomain"
}
8 changes: 4 additions & 4 deletions private/parseMemberEmail.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function parseMemberEmail {
# Extract domain from email
$domain = ($email -split '@')[1]
if ($domain) {
# Get company name from domain (first part before any dots)
$company = ($domain -split '\.')[0]
# Get company name from domain (second-to-last segment, i.e. registered domain before TLD)
$company = ($domain -split '\.')[-2]
# Capitalize first letter if company has content
if ($company.Length -gt 0) {
$company = $company.Substring(0, 1).ToUpper() + $company.Substring(1).ToLower()
Expand Down Expand Up @@ -77,8 +77,8 @@ function parseMemberEmail {
# Extract domain from email
$domain = ($email -split '@')[1]
if ($domain) {
# Get company name from domain (first part before any dots)
$company = ($domain -split '\.')[0]
# Get company name from domain (second-to-last segment, i.e. registered domain before TLD)
$company = ($domain -split '\.')[-2]
# Capitalize first letter if company has content
if ($company.Length -gt 0) {
$company = $company.Substring(0, 1).ToUpper() + $company.Substring(1).ToLower()
Expand Down
Loading