mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-10 01:51:18 +10:00
Fix Win11 Creator product-key validation failures (#4791)
* feat: Enhance Win11 Creator with edition ID handling and update autounattend.xml generation * Strengthen Pester coverage for config and function files
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#===========================================================================
|
||||
# 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user