Tests/Install-PsmDependencies.Tests.ps1

$moduleRoot = Resolve-Path "$PSScriptRoot\.."
$moduleName = Split-Path $moduleRoot -Leaf
Import-Module "$moduleRoot\PSModuleBuilder.psm1"

Describe "Install-PsmDependencies" -Tag "Unit" {
    
    Context 'When in an initialized module folder' {   
        BeforeAll { 
            Write-Host -for DarkGreen "In Describe BeforeAll" 
            
            Write-Verbose "Creating new directory IPsmDependencies"
            Remove-ItemIfExists "$PSScriptRoot\TestPester\IPsmDependencies" | Out-Null
            New-Item "$PSScriptRoot\TestPester\IPsmDependencies" -ItemType Directory -Force
            
            Write-Verbose "Changing location to IPsmDependencies"
            Set-Location "$PSScriptRoot\TestPester\IPsmDependencies"
            
            Initialize-Psm -y
            Get-ChildItem "$PSScriptRoot\TestPester\IPsmDependencies"
        }

        Context "Adding a dependency" {
            InModuleScope PSModuleBuilder {
                # if mocks are needed
                # It "should use mocked functionality -- Verified" {
                # Assert-VerifiableMock
                # }
                # It "should use mocked functionality -- Times Called" {
                # Assert-MockCalled Get-Module -Times 1
                # }
                it "should throw due to not being implemented..." {
                    { Install-PsmDependencies "bits" } | Should -Throw
                }
            }
        }
        Context "Adding a dependency" {
            it "should throw due to not being implemented..." {
                { Install-PsmDependencies "bits" } | Should -Throw
            }
        }
    }

    Context 'When in a non-initialized module folder' {   
        BeforeAll { 
            Write-Host -for DarkGreen "In Describe BeforeAll" 
            Set-Location "$PSScriptRoot\TestPester"
        }
        
        InModuleScope PSModuleBuilder {
            it "should throw due to not being implemented..." {
                { Install-PsmDependencies "bits" } | Should -Throw
            }
        }
    }

    AfterAll {
        Write-Host "Changing back to moduleRoot: $PSScriptRoot"
        Set-Location $PSScriptRoot
    }
}