Skip to content

Commit 9e4e9f1

Browse files
authored
Add cmd compatibility launcher and harden validation tests (#11)
1 parent b5328c0 commit 9e4e9f1

2 files changed

Lines changed: 41 additions & 10 deletions

File tree

DeployWorkstation.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
REM Compatibility launcher for users/docs that still invoke DeployWorkstation.cmd
3+
REM Delegates to DeployWorkstation.bat in the same folder.
4+
setlocal
5+
set "script_dir=%~dp0"
6+
call "%script_dir%DeployWorkstation.bat" %*
7+
exit /b %errorlevel%

tests/DeployWorkstation.Tests.ps1

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,58 @@ if (-not (Get-Module -Name Pester -ListAvailable)) {
66
Describe "DeployWorkstation Prerequisites" {
77
Context "System Requirements" {
88
It "Should be running on Windows 10 or 11" {
9+
if (-not $IsWindows) {
10+
Set-ItResult -Skipped -Because "Windows-only deployment validation"
11+
return
12+
}
13+
914
$osVersion = [System.Environment]::OSVersion.Version
1015
$osVersion.Major | Should -BeGreaterOrEqual 10
1116
}
12-
17+
1318
It "Should have PowerShell 5.1 or later" {
1419
$PSVersionTable.PSVersion.Major | Should -BeGreaterOrEqual 5
1520
}
16-
21+
1722
It "Should have internet connectivity" {
23+
if (-not $IsWindows) {
24+
Set-ItResult -Skipped -Because "Windows-only deployment validation"
25+
return
26+
}
27+
1828
Test-NetConnection -ComputerName "8.8.8.8" -Port 53 -InformationLevel Quiet | Should -Be $true
1929
}
2030
}
21-
31+
2232
Context "File Structure" {
2333
It "Should have main script file" {
2434
Test-Path ".\DeployWorkstation.ps1" | Should -Be $true
2535
}
26-
36+
2737
It "Should have launcher script" {
38+
Test-Path ".\DeployWorkstation.bat" | Should -Be $true
39+
}
40+
41+
It "Should have compatibility launcher script" {
2842
Test-Path ".\DeployWorkstation.cmd" | Should -Be $true
2943
}
30-
44+
3145
It "Should have configuration directory" {
32-
Test-Path ".\Config" | Should -Be $true
46+
Test-Path ".\config" | Should -Be $true
3347
}
3448
}
3549
}
3650

3751
Describe "Configuration Validation" {
3852
Context "JSON Configuration Files" {
39-
$configFiles = Get-ChildItem ".\Config\Examples\*.json" -ErrorAction SilentlyContinue
40-
53+
$configFiles = Get-ChildItem ".\config\Examples\*.json" -ErrorAction SilentlyContinue
54+
4155
foreach ($file in $configFiles) {
4256
It "Should have valid JSON format: $($file.Name)" {
4357
{ Get-Content $file.FullName | ConvertFrom-Json } | Should -Not -Throw
4458
}
4559
}
46-
60+
4761
It "Should have at least one example configuration" {
4862
$configFiles.Count | Should -BeGreaterThan 0
4963
}
@@ -53,10 +67,20 @@ Describe "Configuration Validation" {
5367
Describe "WinGet Availability" {
5468
Context "Package Manager" {
5569
It "Should have WinGet available" {
70+
if (-not $IsWindows) {
71+
Set-ItResult -Skipped -Because "Windows-only deployment validation"
72+
return
73+
}
74+
5675
{ winget --version } | Should -Not -Throw
5776
}
58-
77+
5978
It "Should be able to search for packages" {
79+
if (-not $IsWindows) {
80+
Set-ItResult -Skipped -Because "Windows-only deployment validation"
81+
return
82+
}
83+
6084
$result = winget search "Google.Chrome" --exact
6185
$result | Should -Not -BeNullOrEmpty
6286
}

0 commit comments

Comments
 (0)