mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-22 05:51:30 -06:00
Fix multiple winget entry in json file (#405)
* Update Branch in script * add logic to split ; delimiter * Update Branch in script * update tests * Update Branch in script * Update winutil.ps1 * Update Branch in script * Update winutil.ps1 * Update Branch in script Co-authored-by: DeveloperDurp <DeveloperDurp@users.noreply.github.com> Co-authored-by: Chris Titus <contact@christitus.com> Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
This commit is contained in:
parent
f83ffaf0a9
commit
0951bf5bcd
@ -193,8 +193,26 @@ Describe "GUI Functions" {
|
|||||||
It "Get-CheckBoxes Install should return data" {
|
It "Get-CheckBoxes Install should return data" {
|
||||||
. .\pester.ps1
|
. .\pester.ps1
|
||||||
|
|
||||||
$WPFInstallvc2015_32.ischecked = $true
|
$TestCheckBoxes = @(
|
||||||
(Get-CheckBoxes -Group WPFInstall) | should -Not -BeNullOrEmpty
|
"WPFInstallvc2015_32"
|
||||||
$WPFInstallvc2015_32.ischecked | should -be $false
|
"WPFInstallvscode"
|
||||||
|
"WPFInstallgit"
|
||||||
|
)
|
||||||
|
|
||||||
|
$OutputResult = New-Object System.Collections.Generic.List[System.Object]
|
||||||
|
$TestCheckBoxes | ForEach-Object {
|
||||||
|
|
||||||
|
$global:configs.applications.Install.$psitem.winget -split ";" | ForEach-Object {
|
||||||
|
$OutputResult.Add($psitem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$OutputResult = Sort-Object -InputObject $OutputResult
|
||||||
|
|
||||||
|
$TestCheckBoxes | ForEach-Object {(Get-Variable $PSItem).value.ischecked = $true}
|
||||||
|
$Output = Get-CheckBoxes -Group WPFInstall | Sort-Object
|
||||||
|
$Output | should -Not -BeNullOrEmpty -Because "Output did not containe applications to install"
|
||||||
|
$Output | Should -Not -Be $OutputResult -Because "Output contains duplicate values"
|
||||||
|
$Output | Should -Be $($OutputResult | Select-Object -Unique | Sort-Object) -Because "Output doesn't match"
|
||||||
|
$TestCheckBoxes | ForEach-Object {(Get-Variable $PSItem).value.ischecked | should -be $false}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#for CI/CD
|
#for CI/CD
|
||||||
$BranchToUse = 'test'
|
$BranchToUse = 'hotfix/applications'
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.NOTES
|
.NOTES
|
||||||
|
13
winutil.ps1
13
winutil.ps1
@ -1,5 +1,5 @@
|
|||||||
#for CI/CD
|
#for CI/CD
|
||||||
$BranchToUse = 'main'
|
$BranchToUse = 'hotfix/applications'
|
||||||
<#
|
<#
|
||||||
.NOTES
|
.NOTES
|
||||||
Author : Chris Titus @christitustech
|
Author : Chris Titus @christitustech
|
||||||
@ -117,14 +117,17 @@ Function Get-CheckBoxes {
|
|||||||
|
|
||||||
if($Group -eq "WPFInstall"){
|
if($Group -eq "WPFInstall"){
|
||||||
Foreach ($CheckBox in $CheckBoxes){
|
Foreach ($CheckBox in $CheckBoxes){
|
||||||
if($checkbox.value.ischecked -eq $true){
|
if($CheckBox.value.ischecked -eq $true){
|
||||||
$output.Add("$($configs.applications.install.$($checkbox.name).winget)")
|
$Configs.applications.install.$($CheckBox.name).winget -split ";" | ForEach-Object {
|
||||||
$checkbox.value.ischecked = $false
|
$Output.Add($psitem)
|
||||||
|
}
|
||||||
|
|
||||||
|
$CheckBox.value.ischecked = $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output $Output
|
Write-Output $($Output | Select-Object -Unique)
|
||||||
}
|
}
|
||||||
|
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user