mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-07-18 01:40:49 +00:00
* feat: Enhance Win11 Creator with edition ID handling and update autounattend.xml generation * Strengthen Pester coverage for config and function files
34 lines
1.3 KiB
PowerShell
34 lines
1.3 KiB
PowerShell
#===========================================================================
|
|
# Tests - Win11 Creator
|
|
#===========================================================================
|
|
|
|
Describe "Win11 Creator setup media" {
|
|
It "autounattend template does not force a product key" {
|
|
$templatePath = Join-Path $PSScriptRoot "..\tools\autounattend.xml"
|
|
[xml]$xml = Get-Content -Path $templatePath -Raw
|
|
$nsMgr = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
|
|
$nsMgr.AddNamespace("u", "urn:schemas-microsoft-com:unattend")
|
|
|
|
$productKeyCount = $xml.SelectNodes("//u:ProductKey", $nsMgr).Count
|
|
if ($productKeyCount -ne 0) {
|
|
throw "Expected no ProductKey nodes, found $productKeyCount."
|
|
}
|
|
}
|
|
|
|
It "ISO script accepts selected edition setup metadata" {
|
|
$isoScriptPath = Join-Path $PSScriptRoot "..\functions\private\Invoke-WinUtilISOScript.ps1"
|
|
$content = Get-Content -Path $isoScriptPath -Raw
|
|
|
|
foreach ($pattern in @(
|
|
'\[string\]\$InstallEditionId',
|
|
'\[int\]\$InstallImageIndex',
|
|
'sources\\ei\.cfg',
|
|
'PID\.txt'
|
|
)) {
|
|
if ($content -notmatch $pattern) {
|
|
throw "Expected Invoke-WinUtilISOScript.ps1 to match pattern: $pattern"
|
|
}
|
|
}
|
|
}
|
|
}
|