fix module manifest update logic

This commit is contained in:
2022-07-27 10:35:22 +02:00
parent 6a314eeb48
commit 0784cddb6f
2 changed files with 74 additions and 7 deletions

View File

@ -18,4 +18,40 @@ Describe 'Update-ModuleMeta' {
$foo.Description[0].Text.Length | Should -BeGreaterThan 5
}
}
Context 'Unit Tests' -Tag 'Unit' {
BeforeAll {
# Mock Drone env if its not present
if (!$Env:DRONE) {
$Env:DRONE = $true
$Env:DRONE_BUILD_EVENT = 'tag'
$Env:DRONE_SEMVER = '9.9.9-dev9'
$Env:DRONE_SEMVER_SHORT = '9.9.9'
$Env:DRONE_SEMVER_PRERELEASE = 'dev9'
}
Mock 'Get-RepoPath' -ModuleName 'DroneHelper' {
return @{
Src = @{
Manifest = @{
Item = @{
FullName = './resources/MyModule.psd1'
}
}
}
}
}
}
It 'Update test module manifest' {
{ Update-ModuleMeta } | Should -Not -Throw
}
It 'Updated manifest is valid' {
{ Test-ModuleManifest -Path './resources/MyModule.psd1' } | Should -Not -Throw
}
It 'External dependencies prop is untouched' {
$d = Test-ModuleManifest -Path './resources/MyModule.psd1'
$d.PrivateData.PSData.ExternalModuleDependencies.Count | Should -Be '2'
}
}
}