Created
October 15, 2021 04:05
-
-
Save techthoughts2/1791ffd845ada76afe12dc75250db4ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It 'should run the expected commands if an error is encountered' { | |
Mock -CommandName Invoke-RestMethod { | |
throw 'Fake Error' | |
} #endMock | |
Mock -CommandName Write-Warning { } | |
Mock -CommandName Write-Error { } | |
$sendTelegramContactSplat = @{ | |
BotToken = $token | |
ChatID = $chat | |
PhoneNumber = $phone | |
FirstName = $firstName | |
LastName = $lastName | |
DisableNotification = $true | |
} | |
Send-TelegramContact @sendTelegramContactSplat | |
Assert-MockCalled -CommandName Write-Warning -Times 1 -Scope It | |
Assert-MockCalled -CommandName Write-Error -Times 1 -Scope It | |
} #it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment