30 lines
881 B
PowerShell
30 lines
881 B
PowerShell
|
$here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||
|
. "$here.ps1"
|
||
|
|
||
|
$textBody = @"
|
||
|
This text will handle having one really long 123456789012345678901234567890 word jammed up in the middle that is 30 characters long on a screen width of 25.
|
||
|
"@
|
||
|
|
||
|
Describe "25 characters and a 30 character word" {
|
||
|
|
||
|
# The use of the here-block vs the array join seems to cause the need for a triple return in the middle
|
||
|
$lines_25 = @"
|
||
|
This text will handle
|
||
|
having one really long
|
||
|
123456789012345678901234567890
|
||
|
word jammed up in the
|
||
|
middle that is 30
|
||
|
characters long on a
|
||
|
screen width of 25.
|
||
|
"@
|
||
|
Mock -CommandName Get-ConsoleDisplayWidth -MockWith { return 25 }
|
||
|
|
||
|
Context "Wraps to 25 characters" {
|
||
|
$result = Format-TextWrapToDisplay -InputText $textBody
|
||
|
|
||
|
It "matches" {
|
||
|
($result -join [System.Environment]::NewLine) | Should -Be $lines_25
|
||
|
}
|
||
|
}
|
||
|
}
|