Skip to content

Commit

Permalink
New-DscMofResourceWikiPage: Removed unused mandatory paramete (#100)
Browse files Browse the repository at this point in the history
- `New-DscMofResourceWikiPage`
  - Removed unused mandatory parameter (issue #85).
  • Loading branch information
johlju authored Aug 6, 2021
1 parent 2266299 commit a9ce114
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 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

- `New-DscMofResourceWikiPage`
- Removed unused mandatory parameter ([issue #85](https://github.com/dsccommunity/DscResource.DocGenerator/issues/85)).

## [0.10.0] - 2021-08-05

### Added
Expand Down
9 changes: 0 additions & 9 deletions source/Private/New-DscMofResourceWikiPage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@
The path to the root of the DSC resource module (where the PSD1 file is found,
not the folder for and individual DSC resource).
.PARAMETER BuiltModulePath
The path to the root of the built DSC resource module, e.g.
'output/MyResource/1.0.0'.
.PARAMETER Force
Overwrites any existing file when outputting the generated content.
.EXAMPLE
New-DscMofResourceWikiPage `
-SourcePath C:\repos\MyResource\source `
-BuiltModulePath C:\repos\MyResource\output\MyResource\1.0.0 `
-OutputPath C:\repos\MyResource\output\WikiContent
This example shows how to generate wiki documentation for a specific module.
Expand All @@ -46,10 +41,6 @@ function New-DscMofResourceWikiPage
[System.String]
$SourcePath,

[Parameter(Mandatory = $true)]
[System.String]
$BuiltModulePath,

[Parameter()]
[System.Management.Automation.SwitchParameter]
$Force
Expand Down
8 changes: 7 additions & 1 deletion source/Public/New-DscResourceWikiPage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ function New-DscResourceWikiPage
$Force
)

New-DscMofResourceWikiPage @PSBoundParameters
$newDscMofResourceWikiPageParameters = @{
OutputPath = $OutputPath
SourcePath = $SourcePath
Force = $Force
}

New-DscMofResourceWikiPage @newDscMofResourceWikiPageParameters

New-DscClassResourceWikiPage @PSBoundParameters

Expand Down
1 change: 0 additions & 1 deletion tests/unit/private/New-DscMofResourceWikiPage.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ Configuration Example
$script:newDscResourceWikiPageOutput_parameters = @{
SourcePath = $script:mockSourcePath
OutputPath = $script:mockOutputPath
BuiltModulePath = '.' # Not used for MOF-based resources
Verbose = $true
}

Expand Down
19 changes: 15 additions & 4 deletions tests/unit/public/New-DscResourceWikiPage.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ InModuleScope $script:moduleName {
}

$script:newDscResourceWikiPage_parameterFilter = {
$OutputPath -eq $script:mockOutputPath -and `
$SourcePath -eq $script:mockSourcePath
}

$script:newDscClassResourceWikiPage_parameterFilter = {
$OutputPath -eq $script:mockOutputPath -and `
$SourcePath -eq $script:mockSourcePath -and `
$BuiltModulePath -eq $script:mockBuildModulePath
}

$script:newDscCompositeResourceWikiPage_parameterFilter = {
$OutputPath -eq $script:mockOutputPath -and `
$SourcePath -eq $script:mockSourcePath -and `
$BuiltModulePath -eq $script:mockBuildModulePath
Expand All @@ -46,11 +57,11 @@ InModuleScope $script:moduleName {

Mock `
-CommandName New-DscClassResourceWikiPage `
-ParameterFilter $script:newDscResourceWikiPage_parameterFilter
-ParameterFilter $script:newDscClassResourceWikiPage_parameterFilter

Mock `
-CommandName New-DscCompositeResourceWikiPage `
-ParameterFilter $script:newDscResourceWikiPage_parameterFilter
-ParameterFilter $script:newDscCompositeResourceWikiPage_parameterFilter

It 'Should not throw an exception' {
{ New-DscResourceWikiPage @script:newDscResourceWikiPage_parameters } | Should -Not -Throw
Expand All @@ -64,12 +75,12 @@ InModuleScope $script:moduleName {

Assert-MockCalled `
-CommandName New-DscClassResourceWikiPage `
-ParameterFilter $script:newDscResourceWikiPage_parameterFilter `
-ParameterFilter $script:newDscClassResourceWikiPage_parameterFilter `
-Exactly -Times 1

Assert-MockCalled `
-CommandName New-DscCompositeResourceWikiPage `
-ParameterFilter $script:newDscResourceWikiPage_parameterFilter `
-ParameterFilter $script:newDscCompositeResourceWikiPage_parameterFilter `
-Exactly -Times 1
}
}
Expand Down

0 comments on commit a9ce114

Please sign in to comment.