Tests/Module.Tests.ps1

#### <h1 style="color: #DCA657;">🧪 Module.Tests</h1>
####
#### > Pester unit tests for the manifest and the exported public surface.
####
#### ---
####
#### | Suite | Scope |
#### | --- | --- |
#### | `Manifest` | Module manifest and Gallery metadata. |
#### | `Exported surface` | Public entry point and helper privacy. |
####
#### ---
BeforeAll {
    $script:Manifest = Join-Path $PSScriptRoot '..' 'Sharpdown.psd1'
    Import-Module $script:Manifest -Force
}
AfterAll {
    Remove-Module Sharpdown -Force -ErrorAction SilentlyContinue
}

#### <h2 style="color: #DCA657;">Manifest</h2>
####
#### Validates the module manifest and its Gallery metadata.
####
#### <b style="color: #D2A8FF;">Cases</b>
####
Describe 'Manifest' {
    #### - Parses cleanly through `Test-ModuleManifest`.
    ####
    It 'Passes Test-ModuleManifest' {
        Test-ModuleManifest -Path $script:Manifest | Should -Not -BeNullOrEmpty
    }
    #### - Pins the module version at `1.0.0`.
    ####
    It 'Declares version 1.0.0' {
        (Test-ModuleManifest -Path $script:Manifest).Version | Should -Be ([version]'1.0.0')
    }
    #### - Targets the PowerShell `Core` edition.
    ####
    It 'Targets the Core edition' {
        (Test-ModuleManifest -Path $script:Manifest).CompatiblePSEditions | Should -Contain 'Core'
    }
    #### - Carries the `LicenseUri`, `ProjectUri`, and `SharpDown` tag the Gallery needs.
    ####
    It 'Carries Gallery metadata' {
        $manifest = Test-ModuleManifest -Path $script:Manifest
        $manifest.LicenseUri | Should -Not -BeNullOrEmpty
        $manifest.ProjectUri | Should -Not -BeNullOrEmpty
        $manifest.Tags | Should -Contain 'SharpDown'
    }
}

#### ---
#### <h2 style="color: #DCA657;">Exported surface</h2>
####
#### Confirms only the public entry point escapes the module.
####
#### <b style="color: #D2A8FF;">Cases</b>
####
Describe 'Exported surface' {
    #### - Exports the public `ConvertTo-SharpDown` command.
    ####
    It 'Exports ConvertTo-SharpDown' {
        Get-Command -Module Sharpdown -Name 'ConvertTo-SharpDown' -ErrorAction SilentlyContinue | Should -Not -BeNullOrEmpty
    }
    #### - Keeps the six internal helpers private.
    ####
    It 'Does not export the internal helpers' {
        foreach ($name in 'Convert-SharpDownContent', 'Resolve-SharpDownTarget', 'Write-SharpDownFile', 'Invoke-SharpDownFile', 'Invoke-SharpDownTree', 'ConvertTo-RedactedPath') {
            Get-Command -Module Sharpdown -Name $name -ErrorAction SilentlyContinue | Should -BeNullOrEmpty
        }
    }
}