-
-
Save bielawb/f3cac1d2e0f2aba4753a974c5d2688ad to your computer and use it in GitHub Desktop.
Testujemy - etap drugi - prosty mock i kilka it-ów.
This file contains 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
Describe 'Testujemy, co się stanie gdy polecenia wybuchną nam w rękach' { | |
Mock -CommandName Invoke-WebRequest -MockWith { throw 'Bum!' } | |
try { | |
Get-GitHubPullRequest -Owner Test -Repository TestRepo | |
} catch { | |
$exception = $_.Exception | |
} | |
It 'Jak Invoke-WebRequest wybuchnie, dostaniemy błąd z właścicielem' { | |
$exception.Message | Should Match 'Owned by Test' | |
} | |
It 'Jak Invoke-WebRequest wybuchnie, dostaniemy błąd z repozytorium' { | |
$exception.Message | Should BeLike '* from TestRepo *' | |
} | |
It 'Jak Invoke-WebRequest wybuchnie, nasz błąd też będzie wybuchowy' { | |
$exception.Message | Should BeLike '* Bum!' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment