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'