tests/unit/Private/Get-KlippyRegistryPath.Tests.ps1
|
#Requires -Modules Pester BeforeAll { $modulePath = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) Import-Module "$modulePath/KlippyCLI.psd1" -Force # Access private function via module scope $script:GetRegistryPath = & (Get-Module KlippyCLI) { Get-Command Get-KlippyRegistryPath } } Describe "Get-KlippyRegistryPath" -Tag Unit { It "Should return a path ending with .klippycli" { $path = & (Get-Module KlippyCLI) { Get-KlippyRegistryPath } $path | Should -Match '\.klippycli$' } It "Should return a path under user home directory" { $path = & (Get-Module KlippyCLI) { Get-KlippyRegistryPath } $homePath = [Environment]::GetFolderPath('UserProfile') $path | Should -BeLike "$homePath*" } It "Should return a consistent path on multiple calls" { $path1 = & (Get-Module KlippyCLI) { Get-KlippyRegistryPath } $path2 = & (Get-Module KlippyCLI) { Get-KlippyRegistryPath } $path1 | Should -BeExactly $path2 } } |