Skip to content

Commit

Permalink
Assert-ElevatedUser: Minor change to localization key name (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju authored Dec 11, 2022
1 parent 47af45f commit 05e5294
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- `Assert-ElevatedUser`
- Renamed the localized string key name and prepared the localized string
file to be able to distinguish which key belong to which command.

## [0.12.0] - 2022-12-10

### Added
Expand Down
2 changes: 1 addition & 1 deletion source/Public/Assert-ElevatedUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Assert-ElevatedUser
{
$PSCmdlet.ThrowTerminatingError(
[System.Management.Automation.ErrorRecord]::new(
$script:localizedData.IsElevated_UserNotElevated,
$script:localizedData.ElevatedUser_UserNotElevated,
'UserNotElevated',
[System.Management.Automation.ErrorCategory]::InvalidOperation,
'Command parameters'
Expand Down
4 changes: 3 additions & 1 deletion source/en-US/DscResource.Common.strings.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ ConvertFrom-StringData @'
PropertyNotInDesiredState = The parameter '{0}' is not in desired state. (DRC0040)
PropertyNotInDesiredStateMessage = Property '{0}' is not in desired state. (DRC0041)
NoMatchKeyMessage = NOTMATCH: Value (type '{0}') for property '{1}' does not match. Current state has the key(s) '{2}' and desired state has not. (DRC0042)
IsElevated_UserNotElevated = This command must run in an elevated PowerShell session. (DRC0043)
## Assert-ElevatedUser
ElevatedUser_UserNotElevated = This command must run in an elevated PowerShell session. (DRC0043)
'@
2 changes: 1 addition & 1 deletion tests/Unit/Public/Assert-ElevatedUser.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Describe 'Assert-ElevatedUser' -Tag 'Private' {

It 'Should throw the correct error' -Skip:$mockIsElevated {
InModuleScope -ScriptBlock {
$mockErrorMessage = $script:localizedData.IsElevated_UserNotElevated
$mockErrorMessage = $script:localizedData.ElevatedUser_UserNotElevated

{ Assert-ElevatedUser } | Should -Throw -ExpectedMessage $mockErrorMessage
}
Expand Down

0 comments on commit 05e5294

Please sign in to comment.