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" <kevin.kim@alphatech.com>
- "Laura Lewis" <laura.lewis@alphatech.com>
- "Mark Martinez" <mark.martinez@alphatech.com>
- Betasoft (13)
- Betasoft (14)
- "Amy Adams (She/Her)" <amy.adams@betasoft.com>
- "Bob Brown" <bob.brown@betasoft.com>
- "Charlie Chen" <charlie.chen@betasoft.com>
- "David Dennis" <david.dennis@betasoft.com>
- david.davis@betasoft.com
- emma.edwards@betasoft.com
- george.garcia@betasoft.com
- george.garcia@bookings.betasoft.com
- "Iris Ingram" <iris.ingram@betasoft.com>
- "Jack Johnson" <jack.johnson@betasoft.com>
- "James Jackson" <james.jackson@betasoft.com>
- "Jennifer Jones" <jennifer.jones@betasoft.com>
- "Kyle Knight" <kyle.knight@betasoft.com>
- lisa.lee@betasoft.com
- Bookings (1)
- george.garcia@bookings.betasoft.com
- Deltalab (3)
- "Alice Anderson" <alice.anderson@deltalab.com>
- "Emma Evans, Eric" <emma.evans@deltalab.com>
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 <alice.johnson@emea.contoso.com>, Bob Smith <bob.smith@contoso.com>"

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

# Assert
$expected = @"
- Contoso (2)
- Alice Johnson <alice.johnson@emea.contoso.com>
- Bob Smith <bob.smith@contoso.com>
"@
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