Skip to content

Commit e43ee9e

Browse files
committed
fix: update renamed store-suggestions function calls missed in refactor
The approved-verbs refactor renamed DisableStoreSearchSuggestionsForAllUsers / EnableStoreSearchSuggestionsForAllUsers to Set-StoreSearchSuggestionsDisabledForAllUsers / Set-StoreSearchSuggestionsEnabledForAllUsers, but the two call sites in Invoke-Changes.ps1 still used the old names, so applying or undoing DisableStoreSearchSuggestions on the all-users path failed with 'The term ... is not recognized'. The test suite did not catch this because its BeforeAll stubs also defined the OLD names, masking the dangling calls. Update the call sites, the test stubs/mocks/assertions to the new names, and the two stale .EXAMPLE doc lines. Fixes #717
1 parent 68cacfc commit e43ee9e

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

Scripts/Features/Invoke-Changes.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function Invoke-FeatureApply {
121121
'DisableStoreSearchSuggestions' {
122122
if ($script:Params.ContainsKey("Sysprep")) {
123123
Write-Host "> Disabling Microsoft Store search suggestions in the start menu for all users..."
124-
DisableStoreSearchSuggestionsForAllUsers
124+
Set-StoreSearchSuggestionsDisabledForAllUsers
125125
Write-Host ""
126126
return
127127
}
@@ -159,7 +159,7 @@ function Invoke-FeatureUndo {
159159
'DisableStoreSearchSuggestions' {
160160
if ($script:Params.ContainsKey('Sysprep')) {
161161
Write-Host "> Re-enabling Microsoft Store search suggestions in the start menu for all users..."
162-
EnableStoreSearchSuggestionsForAllUsers
162+
Set-StoreSearchSuggestionsEnabledForAllUsers
163163
Write-Host ""
164164
return
165165
}

Scripts/Features/Set-StoreSearchSuggestions.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
suggestions in the start menu search pane.
1010
1111
.EXAMPLE
12-
DisableStoreSearchSuggestionsForAllUsers
12+
Set-StoreSearchSuggestionsDisabledForAllUsers
1313
#>
1414
function Set-StoreSearchSuggestionsDisabledForAllUsers {
1515
# Get path to Store app database for all users
@@ -93,7 +93,7 @@ function Set-StoreSearchSuggestionsDisabled {
9393
where Store search suggestions appear in the start menu.
9494
9595
.EXAMPLE
96-
EnableStoreSearchSuggestionsForAllUsers
96+
Set-StoreSearchSuggestionsEnabledForAllUsers
9797
#>
9898
function Set-StoreSearchSuggestionsEnabledForAllUsers {
9999
# Get path to Store app database for all users

Tests/Invoke-Changes.Tests.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ BeforeAll {
55
function Enable-TelemetryScheduledTasks {}
66
function Generate-AppsList { @() }
77
function Get-FriendlyTargetUserName { 'current user' }
8-
function EnableStoreSearchSuggestionsForAllUsers {}
8+
function Set-StoreSearchSuggestionsEnabledForAllUsers {}
99
function Set-StoreSearchSuggestionsEnabled { param($StoreAppsDatabase) }
1010
function Get-StoreAppsDatabasePathForUser { param($UserName) 'store.db' }
1111
function Get-UserName { 'Alice' }
@@ -16,7 +16,7 @@ BeforeAll {
1616
function Get-StartMenuBinPathForUser { param($UserName) 'start.bin' }
1717
function Replace-StartMenu { param($startMenuBinFile, $startMenuTemplate) }
1818
function Replace-StartMenuForAllUsers { param($startMenuTemplate) }
19-
function DisableStoreSearchSuggestionsForAllUsers {}
19+
function Set-StoreSearchSuggestionsDisabledForAllUsers {}
2020
function Set-StoreSearchSuggestionsDisabled { param($StoreAppsDatabase) }
2121

2222
. (Join-Path $PSScriptRoot '..\Scripts\Features\Invoke-Changes.ps1')
@@ -70,7 +70,7 @@ Describe 'Invoke-FeatureApply' {
7070
Mock Get-UserName { 'Alice' }
7171
Mock Replace-StartMenu {}
7272
Mock Replace-StartMenuForAllUsers {}
73-
Mock DisableStoreSearchSuggestionsForAllUsers {}
73+
Mock Set-StoreSearchSuggestionsDisabledForAllUsers {}
7474
Mock Set-StoreSearchSuggestionsDisabled {}
7575
Mock Get-StoreAppsDatabasePathForUser { 'store.db' }
7676
Mock Get-Process { @() }
@@ -173,7 +173,7 @@ Describe 'Invoke-FeatureApply' {
173173
$script:Params = @{ Sysprep = $true }
174174
Invoke-FeatureApply -FeatureId 'DisableStoreSearchSuggestions'
175175

176-
Should -Invoke DisableStoreSearchSuggestionsForAllUsers -Times 1 -Exactly
176+
Should -Invoke Set-StoreSearchSuggestionsDisabledForAllUsers -Times 1 -Exactly
177177
Should -Invoke Set-StoreSearchSuggestionsDisabled -Times 0 -Exactly
178178
}
179179
}
@@ -246,7 +246,7 @@ Describe 'Invoke-FeatureUndo' {
246246
DisableTelemetry = [PSCustomObject]@{}
247247
DisableStoreSearchSuggestions = [PSCustomObject]@{}
248248
}
249-
Mock EnableStoreSearchSuggestionsForAllUsers {}
249+
Mock Set-StoreSearchSuggestionsEnabledForAllUsers {}
250250
Mock Set-StoreSearchSuggestionsEnabled {}
251251
Mock Get-StoreAppsDatabasePathForUser { 'store.db' }
252252
Mock Get-UserName { 'Alice' }
@@ -261,7 +261,7 @@ Describe 'Invoke-FeatureUndo' {
261261
) {
262262
$script:Params = $Params
263263
Invoke-FeatureUndo -FeatureId 'DisableStoreSearchSuggestions'
264-
Should -Invoke EnableStoreSearchSuggestionsForAllUsers -Times $AllUsers -Exactly
264+
Should -Invoke Set-StoreSearchSuggestionsEnabledForAllUsers -Times $AllUsers -Exactly
265265
Should -Invoke Set-StoreSearchSuggestionsEnabled -Times $CurrentUser -Exactly -ParameterFilter { $StoreAppsDatabase -eq 'store.db' }
266266
}
267267

0 commit comments

Comments
 (0)