2022-07-13 13:59:25 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2022-07-27 10:35:22 +02:00
|
|
|
|
|
|
|
Context 'Unit Tests' -Tag 'Unit' {
|
|
|
|
It 'Update test module manifest' {
|
2022-07-27 12:33:53 +02:00
|
|
|
{
|
|
|
|
$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'
|
2022-07-27 13:02:19 +02:00
|
|
|
Update-ModuleMeta -Path './resources/MyModule.psd1' -Verbose
|
2022-07-27 12:33:53 +02:00
|
|
|
} | Should -Not -Throw
|
2022-07-27 10:57:37 +02:00
|
|
|
$data = Import-PowerShellDataFile -Path './resources/MyModule.psd1'
|
2022-07-27 10:52:42 +02:00
|
|
|
$data.ModuleVersion | Should -Be '9.9.9'
|
|
|
|
$data.PrivateData.PSData.Prerelease | Should -Be 'dev9'
|
2022-07-27 10:35:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
2022-07-13 13:59:25 +02:00
|
|
|
}
|