Skip to content

Commit

Permalink
Conceptual help for MOF-based resource works again (#56)
Browse files Browse the repository at this point in the history
- Conceptual help for MOF-based resource works again (broken in v0.7.3) (issue #55).
  • Loading branch information
johlju authored Feb 2, 2021
1 parent 6bba769 commit 684f7f2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Conceptual help for MOF-based resource works again (broken in v0.7.3)
([issue #55](https://github.com/dsccommunity/DscResource.DocGenerator/issues/55)).

## [0.7.3] - 2021-02-02

### Added
Expand Down
4 changes: 2 additions & 2 deletions source/Public/New-DscResourcePowerShellHelp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ function New-DscResourcePowerShellHelp
)

#region MOF-based resource
$mofSearchPath = (Join-Path -Path $ModulePath -ChildPath '\**\*.schema.mof')
$mofSchemas = @(Get-ChildItem -Path $mofSearchPath -File -Recurse)
$mofSearchPath = Join-Path -Path $ModulePath -ChildPath '\**\*.schema.mof'
$mofSchemas = @(Get-ChildItem -Path $mofSearchPath -Recurse)

Write-Verbose -Message ($script:localizedData.FoundMofFilesMessage -f $mofSchemas.Count, $ModulePath)

Expand Down
15 changes: 13 additions & 2 deletions tests/unit/public/New-DscResourcePowerShellHelp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ Configuration Example
Context 'When there is no schemas found in the module folder' {
BeforeAll {
Mock `
-CommandName Get-ChildItem `
-ParameterFilter $script:getChildItemSchema_parameterFilter
-CommandName Get-ChildItem

Mock `
-CommandName Out-File `
Expand All @@ -352,6 +351,18 @@ Configuration Example
}

It 'Should call the expected mocks ' {
<#
Regression test for issue https://github.com/dsccommunity/DscResource.DocGenerator/issues/55.
When parameter File is present the command Get-ChildItem
returns 0 (zero) files.
#>
Assert-MockCalled `
-CommandName Get-ChildItem `
-ParameterFilter {
$PSBoundParameters.ContainsKey('File') -eq $false
} `
-Exactly -Times 1

Assert-MockCalled `
-CommandName Get-ChildItem `
-ParameterFilter $script:getChildItemSchema_parameterFilter `
Expand Down

0 comments on commit 684f7f2

Please sign in to comment.