Skip to content

Commit 3516049

Browse files
feat: Adding tests ( Fixes #1 )
1 parent 9551367 commit 3516049

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Servers101.tests.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<#
2+
.SYNOPSIS
3+
Servers 101 Tests
4+
.DESCRIPTION
5+
Tests for the Server 101 module.
6+
#>
7+
8+
$scriptName = $MyInvocation.MyCommand.Name
9+
$scriptFileContent = Get-Content -Raw $MyInvocation.MyCommand.ScriptBlock.File
10+
11+
describe Servers101 {
12+
it 'Gets a list of demo servers' {
13+
Servers101
14+
}
15+
16+
it 'Can get a specific demo server' {
17+
Servers101 -Name Server101
18+
}
19+
20+
it 'Has a working file server' {
21+
$job = . (Servers101 -Name Server101) -RootDirectory $pwd
22+
Write-Warning "$($job.Url)$($scriptName)"
23+
$myResponse = Invoke-RestMethod -Uri "$($job.Url)$($scriptName)"
24+
"$myResponse".Trim() | Should -Be "$scriptFileContent".Trim()
25+
$job.HttpListener.Stop()
26+
}
27+
28+
}

0 commit comments

Comments
 (0)