Functions/Convert-GSuiteUserToMSPCompleteUser.Tests.ps1
describe "BitTitan.Runbooks.GSuite/Convert-GSuiteUserToMSPCompleteUser" -Tag "module", "unit" { # Import the function to test . "$($PSScriptRoot)\Convert-GSuiteUserToMSPCompleteUser.ps1" it "converts an GSuite user to a MSPComplete user" { # Declare the task inputs $GSuiteUser = [PSCustomObject]@{ PrimaryEmail = "primaryEmail" id = "id" name = @{ givenName = "givenName" familyName = "surname" fullName = "displayName" } organizations = @{ name = "company" department = "department" title = "title" } relations = [PSCustomObject]@{ Type = "Manager" Value = "manager@domain.com" } addresses = [PSCustomObject]@{ Type = "home" streetAddress = "streetAddress" postalCode = "postalCode" region = "region" country = "country" locality = "locality" } phones = @( [PSCustomObject]@{ Type = "home" Value = "homePhone" }, [PSCustomObject]@{ Type = "mobile" Value = "mobilePhone" } ) } # Call the function $output = Convert-GSuiteUserToMSPCompleteUser -User $GSuiteUser # Verify the output $output.FirstName | Should Be "givenName" $output.LastName | Should Be "surname" $output.DisplayName | Should Be "displayName" $output.PrimaryEmailAddress | Should Be "primaryEmail" $output.UserPrincipalName | Should Be "primaryEmail" $output.ExtendedProperties.GSuiteUserID | Should Be "id" $output.ExtendedProperties.ManagerEmailAddress | Should Be "manager@domain.com" $output.ExtendedProperties.AddressLine1 | Should Be "streetAddress" $output.ExtendedProperties.PostalOrZipCode | Should Be "postalCode" $output.ExtendedProperties.City | Should Be "locality" $output.ExtendedProperties.StateOrProvince | Should Be "region" $output.ExtendedProperties.CountryOrRegion | Should Be "country" $output.ExtendedProperties.MobilePhoneNumber | Should Be "mobilePhone" $output.ExtendedProperties.TelephoneNumber | Should Be "homePhone" $output.ExtendedProperties.CompanyName | Should Be "company" $output.ExtendedProperties.Department | Should Be "department" $output.ExtendedProperties.JobTitle | Should Be "title" } } |