2018-03-09 14:02:51 +01:00
|
|
|
Describe "Resolve-Dependency" {
|
|
|
|
Context "Basic syntax check" {
|
2019-01-16 12:55:29 +01:00
|
|
|
Mock Get-ModuleBase {return (Join-Path -Path $PWD -ChildPath '/resources')}
|
2018-03-09 14:02:51 +01:00
|
|
|
Mock Test-Module {return $true}
|
|
|
|
It "Test1: Should not throw" {
|
|
|
|
{ Resolve-Dependency -Name 'foobar2000' } | Should -Not -Throw
|
|
|
|
}
|
|
|
|
It "Test2: Output type should be bool" {
|
|
|
|
Resolve-Dependency -Name 'foobar2000' | Should -BeOfType bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Context "Enforce Error" {
|
|
|
|
# Return incorrect module base to enforce there is no config file.
|
2019-01-16 12:55:29 +01:00
|
|
|
Mock Get-ModuleBase {
|
|
|
|
if ($IsWindows) {return "C:\"}
|
|
|
|
elseif ($isLinux) {return "/"}
|
|
|
|
}
|
2018-03-09 14:02:51 +01:00
|
|
|
It "Missing dependency file should not cause an error" {
|
|
|
|
{ Resolve-Dependency -Name 'awesome'} | Should -Not -Throw
|
|
|
|
}
|
|
|
|
|
|
|
|
It "Missing dependency file should return false" {
|
|
|
|
Resolve-Dependency -Name 'awesome' | Should -Be $false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Context "Testing input variations" {
|
2019-01-16 12:55:29 +01:00
|
|
|
Mock Get-ModuleBase {return (Join-Path -Path $PWD -ChildPath '/resources')}
|
2018-03-09 14:02:51 +01:00
|
|
|
It "Should return true if all given dependencies exist" {
|
|
|
|
Resolve-Dependency -Name 'Existing' | Should -Be $true
|
|
|
|
}
|
|
|
|
It "Mixed results should return false" {
|
|
|
|
Resolve-Dependency -Name 'PSGetMixed' | Should -Be $false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|