Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Scripts/Features/Invoke-Changes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function Invoke-FeatureApply {
'DisableStoreSearchSuggestions' {
if ($script:Params.ContainsKey("Sysprep")) {
Write-Host "> Disabling Microsoft Store search suggestions in the start menu for all users..."
DisableStoreSearchSuggestionsForAllUsers
Set-StoreSearchSuggestionsDisabledForAllUsers
Write-Host ""
return
}
Expand Down Expand Up @@ -159,7 +159,7 @@ function Invoke-FeatureUndo {
'DisableStoreSearchSuggestions' {
if ($script:Params.ContainsKey('Sysprep')) {
Write-Host "> Re-enabling Microsoft Store search suggestions in the start menu for all users..."
EnableStoreSearchSuggestionsForAllUsers
Set-StoreSearchSuggestionsEnabledForAllUsers
Write-Host ""
return
}
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Features/Set-StoreSearchSuggestions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
suggestions in the start menu search pane.

.EXAMPLE
DisableStoreSearchSuggestionsForAllUsers
Set-StoreSearchSuggestionsDisabledForAllUsers
#>
function Set-StoreSearchSuggestionsDisabledForAllUsers {
# Get path to Store app database for all users
Expand Down Expand Up @@ -93,7 +93,7 @@ function Set-StoreSearchSuggestionsDisabled {
where Store search suggestions appear in the start menu.

.EXAMPLE
EnableStoreSearchSuggestionsForAllUsers
Set-StoreSearchSuggestionsEnabledForAllUsers
#>
function Set-StoreSearchSuggestionsEnabledForAllUsers {
# Get path to Store app database for all users
Expand Down
12 changes: 6 additions & 6 deletions Tests/Invoke-Changes.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BeforeAll {
function Enable-TelemetryScheduledTasks {}
function Generate-AppsList { @() }
function Get-FriendlyTargetUserName { 'current user' }
function EnableStoreSearchSuggestionsForAllUsers {}
function Set-StoreSearchSuggestionsEnabledForAllUsers {}
function Set-StoreSearchSuggestionsEnabled { param($StoreAppsDatabase) }
function Get-StoreAppsDatabasePathForUser { param($UserName) 'store.db' }
function Get-UserName { 'Alice' }
Expand All @@ -16,7 +16,7 @@ BeforeAll {
function Get-StartMenuBinPathForUser { param($UserName) 'start.bin' }
function Replace-StartMenu { param($startMenuBinFile, $startMenuTemplate) }
function Replace-StartMenuForAllUsers { param($startMenuTemplate) }
function DisableStoreSearchSuggestionsForAllUsers {}
function Set-StoreSearchSuggestionsDisabledForAllUsers {}
function Set-StoreSearchSuggestionsDisabled { param($StoreAppsDatabase) }

. (Join-Path $PSScriptRoot '..\Scripts\Features\Invoke-Changes.ps1')
Expand Down Expand Up @@ -70,7 +70,7 @@ Describe 'Invoke-FeatureApply' {
Mock Get-UserName { 'Alice' }
Mock Replace-StartMenu {}
Mock Replace-StartMenuForAllUsers {}
Mock DisableStoreSearchSuggestionsForAllUsers {}
Mock Set-StoreSearchSuggestionsDisabledForAllUsers {}
Mock Set-StoreSearchSuggestionsDisabled {}
Mock Get-StoreAppsDatabasePathForUser { 'store.db' }
Mock Get-Process { @() }
Expand Down Expand Up @@ -173,7 +173,7 @@ Describe 'Invoke-FeatureApply' {
$script:Params = @{ Sysprep = $true }
Invoke-FeatureApply -FeatureId 'DisableStoreSearchSuggestions'

Should -Invoke DisableStoreSearchSuggestionsForAllUsers -Times 1 -Exactly
Should -Invoke Set-StoreSearchSuggestionsDisabledForAllUsers -Times 1 -Exactly
Should -Invoke Set-StoreSearchSuggestionsDisabled -Times 0 -Exactly
}
}
Expand Down Expand Up @@ -246,7 +246,7 @@ Describe 'Invoke-FeatureUndo' {
DisableTelemetry = [PSCustomObject]@{}
DisableStoreSearchSuggestions = [PSCustomObject]@{}
}
Mock EnableStoreSearchSuggestionsForAllUsers {}
Mock Set-StoreSearchSuggestionsEnabledForAllUsers {}
Mock Set-StoreSearchSuggestionsEnabled {}
Mock Get-StoreAppsDatabasePathForUser { 'store.db' }
Mock Get-UserName { 'Alice' }
Expand All @@ -261,7 +261,7 @@ Describe 'Invoke-FeatureUndo' {
) {
$script:Params = $Params
Invoke-FeatureUndo -FeatureId 'DisableStoreSearchSuggestions'
Should -Invoke EnableStoreSearchSuggestionsForAllUsers -Times $AllUsers -Exactly
Should -Invoke Set-StoreSearchSuggestionsEnabledForAllUsers -Times $AllUsers -Exactly
Should -Invoke Set-StoreSearchSuggestionsEnabled -Times $CurrentUser -Exactly -ParameterFilter { $StoreAppsDatabase -eq 'store.db' }
}

Expand Down
Loading