Skip to content

Commit b2057f3

Browse files
test: update Get-IISParsedLog tests for new record
1 parent b36592f commit b2057f3

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

Module/Tests/Get-IISParsedLog.Tests.ps1

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@ Describe 'Get-IISParsedLog' {
22
It 'returns native object by default' {
33
$logPath = (Resolve-Path "$PSScriptRoot/../../IISParser.Tests/TestData/sample.log").Path
44
$result = Get-IISParsedLog -FilePath $logPath
5-
$result.csUriStem | Should -Be '/index.html'
6-
$result.scStatus | Should -Be 200
5+
$result.UriPath | Should -Be '/index.html'
6+
$result.StatusCode | Should -Be 200
77
($result.PSObject.Properties.Match('X-Forwarded-For').Count) | Should -Be 0
88
($result.PSObject.Properties.Match('xMy_Field').Count) | Should -Be 0
99
$result.Fields['X-Forwarded-For'] | Should -Be '192.168.0.1'
1010
$result.Fields['x(My-Field)'] | Should -Be 'Value'
1111
}
1212

13+
It 'returns legacy object when requested' {
14+
$logPath = (Resolve-Path "$PSScriptRoot/../../IISParser.Tests/TestData/sample.log").Path
15+
$result = Get-IISParsedLog -FilePath $logPath -Legacy
16+
$result.csUriStem | Should -Be '/index.html'
17+
$result.scStatus | Should -Be 200
18+
}
19+
1320
It 'expands fields when requested' {
1421
$logPath = (Resolve-Path "$PSScriptRoot/../../IISParser.Tests/TestData/sample.log").Path
1522
$result = Get-IISParsedLog -FilePath $logPath -Expand
@@ -26,8 +33,8 @@ Describe 'Get-IISParsedLog' {
2633

2734
$result = Get-IISParsedLog -FilePath $logPath -Skip 10 -First 50 -Last 5
2835
$result.Count | Should -Be 5
29-
$result[0].csUriStem | Should -Be '/index55.html'
30-
$result[-1].csUriStem | Should -Be '/index59.html'
36+
$result[0].UriPath | Should -Be '/index55.html'
37+
$result[-1].UriPath | Should -Be '/index59.html'
3138
}
3239

3340
It 'supports SkipLast on large log' {
@@ -38,7 +45,7 @@ Describe 'Get-IISParsedLog' {
3845

3946
$result = Get-IISParsedLog -FilePath $logPath -SkipLast 10
4047
$result.Count | Should -Be 990
41-
$result[-1].csUriStem | Should -Be '/index989.html'
48+
$result[-1].UriPath | Should -Be '/index989.html'
4249
}
4350

4451
It 'returns last records from large log' {
@@ -49,7 +56,7 @@ Describe 'Get-IISParsedLog' {
4956

5057
$result = Get-IISParsedLog -FilePath $logPath -Last 5
5158
$result.Count | Should -Be 5
52-
$result[0].csUriStem | Should -Be '/index995.html'
53-
$result[-1].csUriStem | Should -Be '/index999.html'
59+
$result[0].UriPath | Should -Be '/index995.html'
60+
$result[-1].UriPath | Should -Be '/index999.html'
5461
}
5562
}

0 commit comments

Comments
 (0)