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/FileLinter/Test-FileBOM.Tests.ps1

38 lines
1.2 KiB
PowerShell
Raw Normal View History

2022-07-13 13:59:25 +02:00
BeforeAll {
$Repo = Get-RepoPath
Import-Module $Repo.Src.Manifest.Item.FullName -Force
#$srcFile = Join-Path -Path $Repo.Src.Path -ChildPath 'FileLinter/Test-FileBOM.ps1'
#. "$srcFile"
}
Describe 'Test-FileBOM' {
Context 'Default tests' -Tag 'Default' {
It 'Test Function' {
{ Get-Command -Name 'Test-FileBOM' -Module $Repo.Artifact } | Should -Not -Throw
}
It 'Test Help' {
{ Get-Help -Name 'Test-FileBOM' } | Should -Not -Throw
}
It 'Help Content' {
$foo = Get-Help -Name 'Test-FileBOM'
$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 'Should throw' {
{ Test-FileBOM -foo } | Should -Throw
}
It 'Should not throw' {
{ Test-FileBOM -Path $Repo.Src.Manifest.Item.FullName } | Should -Not -Throw
}
It 'Should return true' {
Test-FileBOM -Path $Repo.Src.Manifest.Item.FullName | Should -Be $true
}
}
}