Skip to content

Commit

Permalink
🩹 [Patch]: Replace Write-Debug with Write-Verbose for improved loggin…
Browse files Browse the repository at this point in the history
…g clarity; update test descriptions for consistency
  • Loading branch information
MariusStorhaug committed Feb 9, 2025
1 parent 944d254 commit 4c7a1f2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/functions/public/Get-Context.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Repositories : {@{Languages=System.Object[]; IsPrivate=False; Stars=130;
CreatedDate=2/9/2024 10:45:11 AM; Name=Repo2}}
AccessScopes : {repo, user, gist, admin:org}
AuthToken : ghp_12345ABCDE67890FGHIJ
AuthToken : MyFirstSuperSecretToken
TwoFactorMethods : {TOTP, SMS}
IsTwoFactorAuth : True
ApiRateLimits : @{ResetTime=2/9/2025 11:15:11 AM; Remaining=4985; Limit=5000}
Expand All @@ -30,7 +30,7 @@
Repositories : {@{Languages=System.Object[]; IsPrivate=False; Stars=130;
CreatedDate=2/9/2024 10:45:11 AM; Name=Repo2}}
AccessScopes : {repo, user, gist, admin:org}
AuthToken : ghp_12345ABCDE67890FGHIJ
AuthToken : MySuperSecretToken
TwoFactorMethods : {TOTP, SMS}
IsTwoFactorAuth : True
ApiRateLimits : @{ResetTime=2/9/2025 11:15:11 AM; Remaining=4985; Limit=5000}
Expand Down Expand Up @@ -103,9 +103,9 @@
}

process {
Write-Debug "Retrieving contexts - ID: [$($ID -join ', ')]"
Write-Verbose "Retrieving contexts - ID: [$($ID -join ', ')]"
foreach ($item in $ID) {
Write-Debug "Retrieving contexts - ID: [$item]"
Write-Verbose "Retrieving contexts - ID: [$item]"
$script:Contexts.Values | Where-Object { $_.ID -like $item } | Select-Object -ExpandProperty Context
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/functions/public/Get-ContextInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
}

process {
Write-Debug "Retrieving context info - ID: [$ID]"
Write-Verbose "Retrieving context info - ID: [$ID]"
foreach ($item in $ID) {
$script:Contexts.Values | Where-Object { $_.ID -like $item } | Select-Object -ExcludeProperty Context
}
Expand Down
4 changes: 2 additions & 2 deletions src/functions/public/Remove-Context.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@

process {
foreach ($item in $ID) {
Write-Debug "Processing ID [$item]"
Write-Verbose "Processing ID [$item]"
$script:Contexts.Keys | Where-Object { $_ -like $item } | ForEach-Object {
Write-Debug "Removing context [$_]"
Write-Verbose "Removing context [$_]"
if ($PSCmdlet.ShouldProcess($_, 'Remove secret')) {
$script:Contexts[$_].Path | Remove-Item -Force

Expand Down
10 changes: 5 additions & 5 deletions tests/Context.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BeforeAll {
}

Describe 'Functions' {
Get-Context 'Function: Set-Context' {
Context 'Function: Set-Context' {
It "Set-Context -ID 'TestID1'" {
{ Set-Context -ID 'TestID1' } | Should -Not -Throw
$result = Get-Context -ID 'TestID1'
Expand Down Expand Up @@ -152,7 +152,7 @@ Describe 'Functions' {
# }
}

Get-Context 'Function: Get-Context' {
Context 'Function: Get-Context' {
It 'Get-Context - Should return all contexts' {
Write-Verbose (Get-Context | Out-String) -Verbose
(Get-Context).Count | Should -Be 3
Expand All @@ -177,7 +177,7 @@ Describe 'Functions' {
}
}

Get-Context 'Function: Remove-Context' {
Context 'Function: Remove-Context' {
It "Remove-Context -ID 'AContextID' - Should remove the context" {
Get-Context | Remove-Context

Expand Down Expand Up @@ -205,7 +205,7 @@ Describe 'Functions' {
}
}

Get-Context 'Function: Rename-Context' {
Context 'Function: Rename-Context' {
BeforeEach {
# Ensure no contexts exist before starting tests
Get-Context | Remove-Context
Expand Down Expand Up @@ -256,7 +256,7 @@ Describe 'Functions' {
}

# New tests to verify that pipeline input is fully supported
Get-Context 'Pipeline Input support' {
Context 'Pipeline Input support' {
It 'Get-Context supports pipeline input as strings' {
# Create two contexts to test pipeline input
Set-Context -ID 'PipeContext1' -Context @{ Dummy = 1 }
Expand Down

0 comments on commit 4c7a1f2

Please sign in to comment.