Skip to content

Commit

Permalink
Fix (tests): Fix tests to be compatible with Pester v5
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Jun 17, 2024
1 parent 644bc49 commit 38c35e8
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 63 deletions.
28 changes: 15 additions & 13 deletions src/PSSourceQuery/public/GoldSourceRcon.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'

Describe "GoldSourceRcon" -Tag 'Unit' {

$gameservers = [ordered]@{
# Goldsource
cstrike = @{
Address = 'cs.startersclan.com'
Port = 27815
}
czero = @{
Address = 'cs.startersclan.com'
Port = 27615
}
valve = @{
Address = 'hl.startersclan.com'
Port = 27915
BeforeEach {
$gameservers = [ordered]@{
# Goldsource
cstrike = @{
Address = 'cs.startersclan.com'
Port = 27815
}
czero = @{
Address = 'cs.startersclan.com'
Port = 27615
}
valve = @{
Address = 'hl.startersclan.com'
Port = 27915
}
}
}

Expand Down
76 changes: 39 additions & 37 deletions src/PSSourceQuery/public/SourceQuery.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,45 @@ Describe "SourceQuery" -Tag 'Unit' {

Context 'Behavior' {

$gameservers = [ordered]@{
# Source
cs2 = @{
Address = 'cs.startersclan.com'
Port = 27125
Engine = 'Source'
}
csgo = @{
Address = 'cs.startersclan.com'
Port = 27115
Engine = 'Source'
}
left4dead2 = @{
Address = 'l4d.startersclan.com'
Port = 27015
Engine = 'Source'
}
hl2mp = @{
Address = 'hl.startersclan.com'
Port = 27215
Engine = 'Source'
}
# Goldsource
cstrike = @{
Address = 'cs.startersclan.com'
Port = 27815
Engine = 'Goldsource'
}
czero = @{
Address = 'cs.startersclan.com'
Port = 27615
Engine = 'Goldsource'
}
valve = @{
Address = 'hl.startersclan.com'
Port = 27915
Engine = 'Goldsource'
BeforeEach {
$gameservers = [ordered]@{
# Source
cs2 = @{
Address = 'cs.startersclan.com'
Port = 27125
Engine = 'Source'
}
csgo = @{
Address = 'cs.startersclan.com'
Port = 27115
Engine = 'Source'
}
left4dead2 = @{
Address = 'l4d.startersclan.com'
Port = 27015
Engine = 'Source'
}
hl2mp = @{
Address = 'hl.startersclan.com'
Port = 27215
Engine = 'Source'
}
# Goldsource
cstrike = @{
Address = 'cs.startersclan.com'
Port = 27815
Engine = 'Goldsource'
}
czero = @{
Address = 'cs.startersclan.com'
Port = 27615
Engine = 'Goldsource'
}
valve = @{
Address = 'hl.startersclan.com'
Port = 27915
Engine = 'Goldsource'
}
}
}

Expand Down
30 changes: 17 additions & 13 deletions src/PSSourceQuery/public/SourceRcon.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'

Describe "SourceRcon" -Tag 'Unit' {

$gameservers = [ordered]@{
# Source
# left4dead2 = @{
# Address = 'l4d.startersclan.com'
# Port = 27015
# }
csgo = @{
Address = 'cs.startersclan.com'
Port = 27115
}
hl2mp = @{
Address = 'hl.startersclan.com'
Port = 27215
BeforeEach {
$gameservers = [ordered]@{
# Source
# left4dead2 = @{
# Address = 'l4d.startersclan.com'
# Port = 27015
# }
csgo = @{
Address = 'cs.startersclan.com'
Port = 27115
}
hl2mp = @{
Address = 'hl.startersclan.com'
Port = 27215
}
}

. "$here/../private/Resolve-DNS.ps1"
}

Context 'Error handling' {
Expand Down

0 comments on commit 38c35e8

Please sign in to comment.