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

42 lines
1.5 KiB
PowerShell

BeforeAll {
$Repo = Get-RepoPath
Import-Module $Repo.Src.Manifest.Item.FullName -Force
#$srcFile = Join-Path -Path $Repo.Src.Path -ChildPath 'FileLinter/Test-FileEncoding.ps1'
#. "$srcFile"
}
Describe 'Test-FileEncoding' {
Context 'Default tests' -Tag 'Default' {
It 'Test Function' {
{ Get-Command -Name 'Test-FileEncoding' -Module $Repo.Artifact } | Should -Not -Throw
}
It 'Test Help' {
{ Get-Help -Name 'Test-FileEncoding' } | Should -Not -Throw
}
It 'Help Content' {
$foo = Get-Help -Name 'Test-FileEncoding'
$foo.Synopsis.Length | Should -BeGreaterThan 5
$foo.Description.Count | Should -BeGreaterOrEqual 1
$foo.Description[0].Text.Length | Should -BeGreaterThan 5
}
}
Context 'Coding tests' -Tag 'Unit' {
It 'Should throw' {
{ Test-FileEncoding -foo } | Should -Throw
}
It 'Should not throw' {
{ Test-FileEncoding -Path $Repo.Src.Manifest.Item.FullName } | Should -Not -Throw
}
It 'Should return true' {
{ Test-FileEncoding -Path $Repo.Src.Manifest.Item.FullName } | Should -Be $true
}
It 'UTF-8 test file should return true' {
Test-FileEncoding -Path (
Join-Path -Path $repo.Resources.Path -ChildPath 'TestData/encodingTest.txt'
) | Should -BeTrue
}
}
}