Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Commit 7930331

Browse files
committed
0.1.5
Fixes: - changed the name of Print-Size to Display-Size QA: - Added tests for Display-Size
1 parent db2e0b4 commit 7930331

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

constup-garbage-cleaner.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ if (Test-Path $cleanupListFile)
174174
$registryEntries = $entities.totalRegistryEntries
175175
Write-Host 'Dry run summary:'
176176
Write-Host '----------'
177-
Print-Size($size)
177+
Display-Size($size)
178178
Write-Host "Total space saved (in exact bytes): $size"
179179
Write-Host "Total registry entries to delete: $registryEntries"
180180
Write-Host "----------"
@@ -278,7 +278,7 @@ if (Test-Path $cleanupListFile)
278278
Write-Host '----------'
279279
}
280280

281-
Print-Size($totalSize)
281+
Display-Size($totalSize)
282282
Write-Host "Total space saved (in exact bytes): $totalSize"
283283
Write-Host "Total registry entries deleted: $totalRegistryEntries"
284284
}

src/math.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function Print-Size {
1+
function Display-Size {
22
param (
33
[Parameter(Mandatory=$true)]
44
[long]$size

tests/math.Tests.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Describe 'Display-Size' {
2+
BeforeAll {
3+
. $PSScriptRoot/../src/math.ps1
4+
Mock Write-Host {}
5+
}
6+
7+
It 'Should display size in KB.' {
8+
Display-Size -size 1025
9+
10+
Should -Invoke Write-Host -Exactly 1
11+
Should -Invoke Write-Host -Exactly 1 -ParameterFilter { $Object -eq "Total space saved: 1 KB" }
12+
}
13+
14+
It 'Should display size in MB.' {
15+
Display-Size -size 1048577
16+
17+
Should -Invoke Write-Host -Exactly 1
18+
Should -Invoke Write-Host -Exactly 1 -ParameterFilter { $Object -eq "Total space saved: 1 MB" }
19+
}
20+
21+
It 'Should display size in GB.' {
22+
Display-Size -size 1073741825
23+
24+
Should -Invoke Write-Host -Exactly 1
25+
Should -Invoke Write-Host -Exactly 1 -ParameterFilter { $Object -eq "Total space saved: 1 GB" }
26+
}
27+
28+
It 'Should not display anything.' {
29+
Display-Size -size 1023
30+
31+
Should -Not -Invoke Write-Host
32+
}
33+
}

0 commit comments

Comments
 (0)