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

Commit b9b7556

Browse files
Fixes for Pester V5
1 parent 4b84ef0 commit b9b7556

4 files changed

Lines changed: 62 additions & 17 deletions

File tree

PSWriteWord.Tests.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ if ($null -eq (Get-Module -ListAvailable PSSharedGoods)) {
1313

1414
Import-Module PSSharedGoods -Force
1515
Import-Module $PSScriptRoot\PSWriteWord.psd1 -Force
16-
Import-Module Pester
17-
18-
Get-Module Pester
19-
Get-Module -ListAvailable Pester
2016

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

Tests/Add-WordList.Tests.ps1

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
$ListOfItems1 = @('Test1')
2-
$ListOfItems2 = @('Test1', 'Test2')
3-
$ListOfItems5 = @('Test1', 'Test2', 'Test3', 'Test4', 'Test5')
1+
Describe 'Add-WordList' {
2+
$ListOfItems1 = @('Test1')
3+
$ListOfItems2 = @('Test1', 'Test2')
4+
$ListOfItems5 = @('Test1', 'Test2', 'Test3', 'Test4', 'Test5')
45

5-
$ListOfItemsNotArray1 = 'Test1'
6-
$ListOfItemsNotArray2 = $false
7-
$ListOfItemsNotArray3 = $false, $true
6+
$ListOfItemsNotArray1 = 'Test1'
7+
$ListOfItemsNotArray2 = $false
8+
$ListOfItemsNotArray3 = $false, $true
89

9-
Describe 'Add-WordList' {
10+
$PSDefaultParameterValues = @{
11+
"It:TestCases" = @{
12+
ListOfItems1 = $ListOfItems1
13+
ListOfItems2 = $ListOfItems2
14+
ListOfItems5 = $ListOfItems5
15+
ListOfItemsNotArray1 = $ListOfItemsNotArray1
16+
ListOfItemsNotArray2 = $ListOfItemsNotArray2
17+
ListOfItemsNotArray3 = $ListOfItemsNotArray3
18+
}
19+
}
1020
It 'Given single string to Add-WordList should properly create a list' {
1121
$WordDocument = New-WordDocument
1222
Add-WordList -WordDocument $WordDocument -ListType Bulleted -ListData $ListOfItemsNotArray1 -Supress $True #-Verbose

Tests/Add-WordPicture.Tests.ps1

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
$FilePath = "$Env:USERPROFILE\Desktop\PSWriteWord-Example-AddPicture2.docx"
2-
$FilePathImage1 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.png"
3-
$FilePathImage2 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.jpg"
4-
5-
$TemporaryFolder = [IO.Path]::GetTempPath()
6-
71
Describe 'Add-WordPicture' {
2+
$FilePath = "$Env:USERPROFILE\Desktop\PSWriteWord-Example-AddPicture2.docx"
3+
$FilePathImage1 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.png"
4+
$FilePathImage2 = "$PSScriptRoot\..\Examples\Images\Logo-Evotec-Small.jpg"
5+
6+
$TemporaryFolder = [IO.Path]::GetTempPath()
7+
8+
$PSDefaultParameterValues = @{
9+
"It:TestCases" = @{
10+
FilePath = $FilePath
11+
FilePathImage1 = $FilePathImage1
12+
FilePathImage2 = $FilePathImage2
13+
TemporaryFolder = $TemporaryFolder
14+
}
15+
}
816
It 'Given 2 pictures, one with rotation - Adding them in memory should work properly' {
917
$FilePath = [IO.Path]::Combine($TemporaryFolder, "1.docx")
1018

Tests/Add-WordTable.Tests.ps1

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,37 @@ $Array += Get-ObjectType -Object $InvoiceDataOrdered2 -ObjectName '$InvoiceDataO
114114
$Array | Format-Table -AutoSize
115115
#>
116116

117+
118+
$PSDefaultParameterValues = @{
119+
"It:TestCases" = @{
120+
InvoiceDataOrdered2 = $InvoiceDataOrdered2
121+
InvoiceDataOrdered1 = $InvoiceDataOrdered1
122+
InvoiceEntry8 = $InvoiceEntry8
123+
InvoiceEntry7 = $InvoiceEntry7
124+
myArray1 = $myArray1
125+
myArray2 = $myArray2
126+
myObject3 = $myObject3
127+
myObject2 = $myObject2
128+
Object1 = $Object1
129+
Object2 = $Object2
130+
Object3 = $Object3
131+
Object4 = $Object4
132+
InvoiceData4 = $InvoiceData4
133+
InvoiceData3 = $InvoiceData3
134+
InvoiceData2 = $InvoiceData2
135+
InvoiceData1 = $InvoiceData1
136+
InvoiceEntry1 = $InvoiceEntry1
137+
InvoiceEntry2 = $InvoiceEntry2
138+
InvoiceEntry3 = $InvoiceEntry3
139+
InvoiceEntry4 = $InvoiceEntry4
140+
InvoiceEntry5 = $InvoiceEntry5
141+
myitems0 = $myitems0
142+
myitems1 = $myitems1
143+
myitems2 = $myitems2
144+
obj = $obj
145+
}
146+
}
147+
117148
Describe 'Add-WordTable - Should deliver same results as Format-Table -Autosize' {
118149
It 'Given (MyItems0) should have 3 columns, 4 rows, 3rd row 3rd column should be Food lover' {
119150

0 commit comments

Comments
 (0)