PrivateFunctions/Assert-GSuiteConnection.Tests.ps1
describe "GSuite/Assert-GSuiteConnection" -Tag "module", "unit" { # Import the function under test . "$($PSScriptRoot)/Assert-GSuiteConnection.ps1" it "throws an exception when GSuiteAccessTokensHashTable does not exist" { # Call the function { Assert-GSuiteConnection -Scope "User" } | Should -Throw } it "throws an exception when GSuiteAccessTokensHashTable does not contain the access token for the required scope" { # Declare the function inputs $Global:GSuiteAccessTokensHashTable = @{ User = "UserAccessToken" } # Call the function { Assert-GSuiteConnection -Scope "Group" } | Should -Throw } it "verifies that the access token for the required scope is present" { # Declare the function inputs $Global:GSuiteAccessTokensHashTable = @{ User = "UserAccessToken" } # Call the function { Assert-GSuiteConnection -Scope "User" } | Should -Not -Throw } # Set the GSuiteAccessTokensHashTable back to null $Global:GSuiteAccessTokensHashTable = $null } |