Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Fixes for Pester V5
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Jun 3, 2020
1 parent 4b84ef0 commit b9b7556
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 17 deletions.
4 changes: 0 additions & 4 deletions PSWriteWord.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ if ($null -eq (Get-Module -ListAvailable PSSharedGoods)) {

Import-Module PSSharedGoods -Force
Import-Module $PSScriptRoot\PSWriteWord.psd1 -Force
Import-Module Pester

Get-Module Pester
Get-Module -ListAvailable Pester

$result = Invoke-Pester -Script $PSScriptRoot\Tests -Verbose -EnableExit

Expand Down
24 changes: 17 additions & 7 deletions Tests/Add-WordList.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
$ListOfItems1 = @('Test1')
$ListOfItems2 = @('Test1', 'Test2')
$ListOfItems5 = @('Test1', 'Test2', 'Test3', 'Test4', 'Test5')
Describe 'Add-WordList' {
$ListOfItems1 = @('Test1')
$ListOfItems2 = @('Test1', 'Test2')
$ListOfItems5 = @('Test1', 'Test2', 'Test3', 'Test4', 'Test5')

$ListOfItemsNotArray1 = 'Test1'
$ListOfItemsNotArray2 = $false
$ListOfItemsNotArray3 = $false, $true
$ListOfItemsNotArray1 = 'Test1'
$ListOfItemsNotArray2 = $false
$ListOfItemsNotArray3 = $false, $true

Describe 'Add-WordList' {
$PSDefaultParameterValues = @{
"It:TestCases" = @{
ListOfItems1 = $ListOfItems1
ListOfItems2 = $ListOfItems2
ListOfItems5 = $ListOfItems5
ListOfItemsNotArray1 = $ListOfItemsNotArray1
ListOfItemsNotArray2 = $ListOfItemsNotArray2
ListOfItemsNotArray3 = $ListOfItemsNotArray3
}
}
It 'Given single string to Add-WordList should properly create a list' {
$WordDocument = New-WordDocument
Add-WordList -WordDocument $WordDocument -ListType Bulleted -ListData $ListOfItemsNotArray1 -Supress $True #-Verbose
Expand Down
20 changes: 14 additions & 6 deletions Tests/Add-WordPicture.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
$FilePath = "$Env:USERPROFILE\Desktop\PSWriteWord-Example-AddPicture2.docx"
$FilePathImage1 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.png"
$FilePathImage2 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.jpg"

$TemporaryFolder = [IO.Path]::GetTempPath()

Describe 'Add-WordPicture' {
$FilePath = "$Env:USERPROFILE\Desktop\PSWriteWord-Example-AddPicture2.docx"
$FilePathImage1 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.png"
$FilePathImage2 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.jpg"

$TemporaryFolder = [IO.Path]::GetTempPath()

$PSDefaultParameterValues = @{
"It:TestCases" = @{
FilePath = $FilePath
FilePathImage1 = $FilePathImage1
FilePathImage2 = $FilePathImage2
TemporaryFolder = $TemporaryFolder
}
}
It 'Given 2 pictures, one with rotation - Adding them in memory should work properly' {
$FilePath = [IO.Path]::Combine($TemporaryFolder, "1.docx")

Expand Down
31 changes: 31 additions & 0 deletions Tests/Add-WordTable.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,37 @@ $Array += Get-ObjectType -Object $InvoiceDataOrdered2 -ObjectName '$InvoiceDataO
$Array | Format-Table -AutoSize
#>


$PSDefaultParameterValues = @{
"It:TestCases" = @{
InvoiceDataOrdered2 = $InvoiceDataOrdered2
InvoiceDataOrdered1 = $InvoiceDataOrdered1
InvoiceEntry8 = $InvoiceEntry8
InvoiceEntry7 = $InvoiceEntry7
myArray1 = $myArray1
myArray2 = $myArray2
myObject3 = $myObject3
myObject2 = $myObject2
Object1 = $Object1
Object2 = $Object2
Object3 = $Object3
Object4 = $Object4
InvoiceData4 = $InvoiceData4
InvoiceData3 = $InvoiceData3
InvoiceData2 = $InvoiceData2
InvoiceData1 = $InvoiceData1
InvoiceEntry1 = $InvoiceEntry1
InvoiceEntry2 = $InvoiceEntry2
InvoiceEntry3 = $InvoiceEntry3
InvoiceEntry4 = $InvoiceEntry4
InvoiceEntry5 = $InvoiceEntry5
myitems0 = $myitems0
myitems1 = $myitems1
myitems2 = $myitems2
obj = $obj
}
}

Describe 'Add-WordTable - Should deliver same results as Format-Table -Autosize' {
It 'Given (MyItems0) should have 3 columns, 4 rows, 3rd row 3rd column should be Food lover' {

Expand Down

0 comments on commit b9b7556

Please sign in to comment.