|
| 1 | +# cSpell:ignore BHPS Ffoo Subkeys |
1 | 2 | BeforeDiscovery { |
2 | 3 | $manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest |
3 | 4 | $outputDir = Join-Path -Path $env:BHProjectPath -ChildPath 'Output' |
@@ -98,88 +99,88 @@ Chocolatey upgraded 0/1 packages. |
98 | 99 |
|
99 | 100 | Describe 'Read-ChocoLog' { |
100 | 101 | BeforeAll { |
101 | | - $parsed = Read-ChocoLog -Path $singleFile |
102 | | - $multiple = Read-ChocoLog -Path $folder |
103 | | - $moreLimit = Read-ChocoLog -Path $folder -FileLimit 10 |
| 102 | + $script:parsed = Read-ChocoLog -Path $singleFile |
| 103 | + $script:multiple = Read-ChocoLog -Path $folder |
| 104 | + $script:moreLimit = Read-ChocoLog -Path $folder -FileLimit 10 |
104 | 105 | } |
105 | 106 |
|
106 | 107 | Context 'For Single File' { |
107 | 108 | It 'Parses the correct number of sessions' { |
108 | | - ($parsed).Count | Should -Be 3 |
| 109 | + ($script:parsed).Count | Should -Be 3 |
109 | 110 | } |
110 | 111 |
|
111 | 112 | It 'Parses the correct number of lines per session' { |
112 | | - $parsed[1].logs.Count | Should -Be 10 |
| 113 | + $script:parsed[1].logs.Count | Should -Be 10 |
113 | 114 | } |
114 | 115 |
|
115 | 116 | It 'Detects the exit code' { |
116 | | - $parsed[1].exitCode | Should -Be 100 |
| 117 | + $script:parsed[1].exitCode | Should -Be 100 |
117 | 118 | } |
118 | 119 |
|
119 | 120 | It 'Detects the right session number' { |
120 | | - $parsed[1].thread | Should -Be 57332 |
| 121 | + $script:parsed[1].thread | Should -Be 57332 |
121 | 122 | } |
122 | 123 |
|
123 | 124 | It 'Has Configuration with Subkeys' { |
124 | | - $parsed[1].Configuration['Features']['UsePackageExitCodes'] | Should -Be 'True' |
| 125 | + $script:parsed[1].Configuration['Features']['UsePackageExitCodes'] | Should -Be 'True' |
125 | 126 | } |
126 | 127 | } |
127 | 128 |
|
128 | 129 | Context 'For Folder Path' { |
129 | 130 | It 'Parses the correct default number of sessions' { |
130 | 131 | # There is two sessions in each file and we grab one file by default |
131 | 132 | # 1 for $randID and 1 for $randID2 |
132 | | - ($multiple).Count | Should -Be 2 |
| 133 | + ($script:multiple).Count | Should -Be 2 |
133 | 134 | } |
134 | 135 |
|
135 | 136 | It 'Parses the correct number of sessions for increased limit' { |
136 | 137 | # There is one session in each file so there should be a total of 10 |
137 | 138 | # 5 for $randID and 5 for $randID2 |
138 | | - ($moreLimit).Count | Should -Be 20 |
| 139 | + ($script:moreLimit).Count | Should -Be 20 |
139 | 140 | } |
140 | 141 |
|
141 | 142 | It 'Parses the correct number of lines per session' { |
142 | | - $multiple[0].logs.Count | Should -Be 9 |
| 143 | + $script:multiple[0].logs.Count | Should -Be 9 |
143 | 144 | } |
144 | 145 | } |
145 | 146 | } |
146 | 147 |
|
147 | 148 | Describe 'Get-ChocoLogEntry' { |
148 | 149 | BeforeAll { |
149 | | - $parsedEntry = Get-ChocoLogEntry -Path $singleFile |
150 | | - $multipleEntry = Get-ChocoLogEntry -Path $folder |
| 150 | + $script:parsedEntry = Get-ChocoLogEntry -Path $singleFile |
| 151 | + $script:multipleEntry = Get-ChocoLogEntry -Path $folder |
151 | 152 | } |
152 | 153 |
|
153 | 154 | Context 'For Single File' { |
154 | 155 | It 'Parses the correct number of sessions' { |
155 | | - ($parsedEntry).Count | Should -Be 1 |
| 156 | + ($script:parsedEntry).Count | Should -Be 1 |
156 | 157 | } |
157 | 158 |
|
158 | 159 | It 'Parses the correct number of lines per session' { |
159 | | - $parsedEntry.logs.Count | Should -Be 10 |
| 160 | + $script:parsedEntry.logs.Count | Should -Be 10 |
160 | 161 | } |
161 | 162 |
|
162 | 163 | It 'Detects the exit code' { |
163 | | - $parsedEntry.exitCode | Should -Be 900 |
| 164 | + $script:parsedEntry.exitCode | Should -Be 900 |
164 | 165 | } |
165 | 166 |
|
166 | 167 | It 'Detects the right session number' { |
167 | | - $parsedEntry.thread | Should -Be 54321 |
| 168 | + $script:parsedEntry.thread | Should -Be 54321 |
168 | 169 | } |
169 | 170 |
|
170 | 171 | It 'Has Configuration with Subkeys' { |
171 | | - $parsedEntry.Configuration['Features']['UsePackageExitCodes'] | Should -Be 'True' |
| 172 | + $script:parsedEntry.Configuration['Features']['UsePackageExitCodes'] | Should -Be 'True' |
172 | 173 | } |
173 | 174 | } |
174 | 175 |
|
175 | 176 | Context 'For Folder Path' { |
176 | 177 | It 'Parses the correct default number of sessions' { |
177 | 178 | # Should still only return 1 regardless of folder |
178 | | - ($multipleEntry).Count | Should -Be 1 |
| 179 | + ($script:multipleEntry).Count | Should -Be 1 |
179 | 180 | } |
180 | 181 |
|
181 | 182 | It 'Parses the correct number of lines per session' { |
182 | | - $multipleEntry.logs.Count | Should -Be 2 |
| 183 | + $script:multipleEntry.logs.Count | Should -Be 2 |
183 | 184 | } |
184 | 185 | } |
185 | 186 | } |
0 commit comments