-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests):add Get-ReleaseAsset tests
- Loading branch information
1 parent
b73fef5
commit 1a5ff2c
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BeforeAll { | ||
Import-Module $PSScriptRoot/ps-arch-wsl.psm1 -Force | ||
} | ||
|
||
Describe "Get-ReleaseAsset" { | ||
It "Finds the release asset" { | ||
InModuleScope ps-arch-wsl { | ||
$foundAsset = Get-ReleaseAsset -Repository "yuk7/ArchWSL" -AssetFilter "cer" | ||
$latestCertificateInTemp = Get-ChildItem $env:Temp | Where-Object { $_.FullName -like "*.cer" } | Sort-Object -Property CreationTime -Descending | ||
$foundAsset | Should -Be $latestCertificateInTemp[0].FullName | ||
} | ||
} | ||
|
||
It "Can't find the release asset" { | ||
InModuleScope ps-arch-wsl { | ||
$repository = "yuk7/ArchWSL" | ||
$filter = "someNonExistentExt" | ||
{ Get-ReleaseAsset -Repository $repository -AssetFilter $filter } | Should -Throw -ExpectedMessage "Failed to find an asset matching the filter '$filter' from the latest release of $repository." | ||
} | ||
} | ||
|
||
It "Can't find the repository" { | ||
InModuleScope ps-arch-wsl { | ||
$repository = "scottmckendry/norepositoryhere" | ||
$filter = "doesntmatter" | ||
{ Get-ReleaseAsset -Repository $repository -AssetFilter $filter } | Should -Throw -ExpectedMessage "$repository doesn't exist or has no releases." | ||
} | ||
} | ||
} |