Test/Unit/Module.Exports.Tests.ps1
|
Describe 'Module Exports' -Tag Unit { BeforeAll { # Setting up the test environment $ModulePath = (Get-Item $PSScriptRoot\..\..).FullName $ModuleName = $ModuleName $TestsPath = $TestsPath $ManifestPath = $ManifestPath } It 'exports all functions declared in manifest' { $Manifest = Import-PowerShellDataFile "$ManifestPath" $NeedToExport = (Get-ChildItem -Path "$ModulePath\Public\*.ps1" | ForEach-Object { $_.BaseName }) foreach ($Fn in $Manifest.FunctionsToExport) { $NeedToExport | Should -Contain $Fn } } It 'test Get-Help for exported functions' { (Get-Command -Module $ModuleName) | ForEach-Object { $HelpInfo = Get-Help -Name $_.Name -ErrorAction SilentlyContinue $HelpInfo | Should -Not -BeNullOrEmpty } } } |