Skip to content
This repository has been archived by the owner on Dec 25, 2019. It is now read-only.

Commit

Permalink
added missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flofreud committed May 30, 2014
1 parent a03d749 commit 464e0f3
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions Utils.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,47 @@ Describe 'Check-Available-Broadcast' {
}

Describe 'Invoke-Self-Update' {
Context 'Selfupdate will be triggered' {
Mock Write-Output -verifiable -parameterFilter { $InputObject -eq 'The self-update feature of posh-gvm does not match gvm selfupdate.'}
Mock Write-Output -verifiable -parameterFilter { $InputObject -eq 'Only the update of the candidate list is supported currently.'}
Context 'Selfupdate will be triggered, no force, no new version' {
Mock Update-Candidates-Cache -verifiable
Mock Write-Output -verifiable
Mock Is-New-Posh-GVM-Version-Available { $false }
Mock Invoke-Posh-Gvm-Update

Invoke-Self-Update

It 'updates the candidate cache' {
Assert-VerifiableMocks
}

It 'does not updates itself' {
Assert-MockCalled Invoke-Posh-Gvm-Update -Times 0
}
}

Context 'Selfupdate will be triggered, no force, new version' {
Mock Update-Candidates-Cache -verifiable
Mock Write-Output -verifiable
Mock Is-New-Posh-GVM-Version-Available { $true }
Mock Invoke-Posh-Gvm-Update -verifiable

Invoke-Self-Update

It 'updates the candidate cache and version' {
Assert-VerifiableMocks
}
}

Context 'Selfupdate will be triggered, force, no new version' {
Mock Update-Candidates-Cache -verifiable
Mock Write-Output -verifiable
Mock Is-New-Posh-GVM-Version-Available { $false }
Mock Invoke-Posh-Gvm-Update -verifiable

Invoke-Self-Update -Force $true

It 'updates the candidate cache and version' {
Assert-VerifiableMocks
}
}
}

Expand Down

0 comments on commit 464e0f3

Please sign in to comment.