test/nexus.Tests.ps1
$ModuleManifestName = 'nexus.psd1' $ModuleManifestPath = "$PSScriptRoot\..\$ModuleManifestName" Import-Module -Name $ModuleManifestPath -Force Describe 'Module Manifest Tests' { It 'Passes Test-ModuleManifest' { Test-ModuleManifest -Path $ModuleManifestPath | Should Not BeNullOrEmpty $? | Should Be $true } } Describe "Search-NexusComponents" { Context "If repository name is valid" { It "It should return multiple data if regex matches" { (Search-NexusComponents -keyword "proxy-aZ" -repositoryName "fed-hosted-prod").group.gettype().BaseType.Name | Should -Be "Array" } It "It should return no data if regex doesnt match" { (Search-NexusComponents -keyword "proxy-a123Z" -repositoryName "fed-hosted-prod") | Should -Be $null } } Context "If repository name is invalid" { It "It should return exception" { {Search-NexusComponents -keyword "proxy-a123Z" -repositoryName "fed-hosted-proad"} | Should -Throw } } } Describe "Get-NexusComponentsInGroup" { Context "If nexus path is valid" { It "It should list all artifacts in it" { (Get-NexusComponentsInGroup -repositoryName "ci-artifacts" -componentGroup "/fed-app/build/hzn-app")[0].downloadUrl | Should -Match "hzn-app" } } } |