← Docs home

🧪 SharpDown.Tests

Pester unit tests for ConvertTo-SharpDown. Ported from the legacy Test-SharpDown.ps1 smoke harness.

The temp-path helpers live in BeforeAll because Pester 5 only exposes functions defined there to the It blocks at run time. Top-level function definitions run during discovery and vanish.

function New-TempLeafPath
function New-TempWorkspace

CSharp file mode

Single-file conversion of C# sources.

Cases

Describe 'CSharp file mode'
It 'Strips //// markers and fences declaration lines'
It 'Skips lines that are neither markers nor declarations'
It 'Throws when File path is not a file'
It 'Throws when File OutPath points to an existing directory'
It 'Warns when source has no SharpDown content'

Language configs

Per-language markers, fences, and the -API switch.

Cases

Describe 'Language configs'
It 'Sql marker ---- fences CREATE statements'
It 'PowerShell marker #### fences function declarations'
It 'JavaScript marker //// fences export class declarations'
It '-API suppresses all auto-generated declaration fences'
It 'JavaScript drops interior const/let locals but keeps top-level function and type declarations'

Directory mode

Recursive tree walking, mirroring, and pipeline input.

Cases

Describe 'Directory mode'
It 'Throws when -Recurse path is not a directory'
It 'Throws when -Recurse OutPath points to an existing file'
It 'Without -Recurse, a directory path throws as not-a-file'
It 'Mirrors tree, strips src/ and project name legs'
It 'Accepts a piped DirectoryInfo as -Path under -Recurse'
It 'Processes multiple directories piped into a single invocation'
It 'Warns when directory has no matching extensions'