|
1 | | -Describe "DeployWorkstation Tests" { |
2 | | - Context "Prerequisites" { |
3 | | - It "Should detect Windows version" { |
4 | | - # Test Windows version detection |
| 1 | +# Import Pester module (install if not available) |
| 2 | +if (-not (Get-Module -Name Pester -ListAvailable)) { |
| 3 | + Install-Module -Name Pester -Force -SkipPublisherCheck |
| 4 | +} |
| 5 | + |
| 6 | +Describe "DeployWorkstation Prerequisites" { |
| 7 | + Context "System Requirements" { |
| 8 | + It "Should be running on Windows 10 or 11" { |
| 9 | + $osVersion = [System.Environment]::OSVersion.Version |
| 10 | + $osVersion.Major | Should -BeGreaterOrEqual 10 |
| 11 | + } |
| 12 | + |
| 13 | + It "Should have PowerShell 5.1 or later" { |
| 14 | + $PSVersionTable.PSVersion.Major | Should -BeGreaterOrEqual 5 |
5 | 15 | } |
6 | | - It "Should verify PowerShell version" { |
7 | | - # Test PowerShell requirements |
| 16 | + |
| 17 | + It "Should have internet connectivity" { |
| 18 | + Test-NetConnection -ComputerName "8.8.8.8" -Port 53 -InformationLevel Quiet | Should -Be $true |
8 | 19 | } |
9 | 20 | } |
10 | 21 |
|
11 | | - Context "Application Management" { |
12 | | - It "Should list removable applications" { |
13 | | - # Test bloatware detection |
| 22 | + Context "File Structure" { |
| 23 | + It "Should have main script file" { |
| 24 | + Test-Path ".\DeployWorkstation.ps1" | Should -Be $true |
| 25 | + } |
| 26 | + |
| 27 | + It "Should have launcher script" { |
| 28 | + Test-Path ".\DeployWorkstation.cmd" | Should -Be $true |
| 29 | + } |
| 30 | + |
| 31 | + It "Should have configuration directory" { |
| 32 | + Test-Path ".\Config" | Should -Be $true |
| 33 | + } |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +Describe "Configuration Validation" { |
| 38 | + Context "JSON Configuration Files" { |
| 39 | + $configFiles = Get-ChildItem ".\Config\Examples\*.json" -ErrorAction SilentlyContinue |
| 40 | + |
| 41 | + foreach ($file in $configFiles) { |
| 42 | + It "Should have valid JSON format: $($file.Name)" { |
| 43 | + { Get-Content $file.FullName | ConvertFrom-Json } | Should -Not -Throw |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + It "Should have at least one example configuration" { |
| 48 | + $configFiles.Count | Should -BeGreaterThan 0 |
| 49 | + } |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +Describe "WinGet Availability" { |
| 54 | + Context "Package Manager" { |
| 55 | + It "Should have WinGet available" { |
| 56 | + { winget --version } | Should -Not -Throw |
| 57 | + } |
| 58 | + |
| 59 | + It "Should be able to search for packages" { |
| 60 | + $result = winget search "Google.Chrome" --exact |
| 61 | + $result | Should -Not -BeNullOrEmpty |
14 | 62 | } |
15 | 63 | } |
16 | 64 | } |
0 commit comments