Skip to content

Commit 405be70

Browse files
committed
Add a test for Convert-CodeCoverage
1 parent 8e96bd5 commit 405be70

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Describe "Convert-CodeCoverage"
2+
3+
It 'Should extract code coverage from Pester objects and add Source conversions' {
4+
5+
# Note: Pester does not currently apply custom types...
6+
$PesterResults = [PSCustomObject]@{
7+
CodeCoverage = [PSCustomObject]@{
8+
MissedCommands = [PSCustomObject]@{
9+
# Note these don't really matter
10+
Command = $ModuleSource[25]
11+
Function = 'CopyReadme'
12+
# these are pipeline bound
13+
File = $ModulePath
14+
Line = 25
15+
}
16+
}
17+
}
18+
19+
$SourceLocation = $PesterResults | Convert-CodeCoverage
20+
21+
$SourceLocation.SourceFile | Should -Be ".\Private\CopyReadme.ps1"
22+
$SourceLocation.SourceLineNumber | Should -Be 24
23+
$SourceLocation.Function | Should -Be 'CopyReadme'
24+
}
25+
}

0 commit comments

Comments
 (0)