OCram85/DroneHelper
OCram85
/
DroneHelper
Archived
1
0
Fork 0
This repository has been archived on 2023-10-10. You can view files and clone it, but cannot push or open issues or pull requests.
DroneHelper/src/Build/Update-ModuleMeta.Tests.ps1

47 lines
1.7 KiB
PowerShell

BeforeAll {
$Repo = Get-RepoPath
Import-Module $Repo.Src.Manifest.Item.FullName -Force
}
Describe 'Update-ModuleMeta' {
Context 'Default tests' -Tag 'Default' {
It 'Test Function' {
{ Get-Command -Name 'Update-ModuleMeta' -Module $Repo.Artifact } | Should -Not -Throw
}
It 'Test Help' {
{ Get-Help -Name 'Update-ModuleMeta' } | Should -Not -Throw
}
It 'Help Content' {
$foo = Get-Help -Name 'Update-ModuleMeta'
$foo.Synopsis.Length | Should -BeGreaterThan 5
$foo.Description.Count | Should -BeGreaterOrEqual 1
$foo.Description[0].Text.Length | Should -BeGreaterThan 5
}
}
Context 'Unit Tests' -Tag 'Unit' {
It 'Update test module manifest' {
{
$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'
Update-ModuleMeta -Path './resources/MyModule.psd1' -Verbose
} | Should -Not -Throw
$data = Import-PowerShellDataFile -Path './resources/MyModule.psd1'
$data.ModuleVersion | Should -Be '9.9.9'
$data.PrivateData.PSData.Prerelease | Should -Be 'dev9'
}
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'
}
}
}