Skip to content

Commit e40c60a

Browse files
🐛 Adjust typos, parameters, remove unused lines (#390)
1 parent cc41ad3 commit e40c60a

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

PSKoans/Koans/Cmdlets 2/AboutCsvCmdlets.Koans.ps1

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Describe '*-Csv Cmdlets' {
5656

5757
It 'stores the data accurately' {
5858
# Now if we read the file as text, let's see what's inside!
59-
$FileContents = Get-Content -Path "$TestDrove/Data.csv"
59+
$FileContents = Get-Content -Path "$TestDrive/Data.csv"
6060

6161
<#
6262
The headers (first line) will list the property names from the objects in question.
@@ -91,27 +91,24 @@ Describe '*-Csv Cmdlets' {
9191
All data will be imported as an array of PSCustomObjects with string properties.
9292
#>
9393
BeforeAll {
94-
$Letters = 'abcdefghijklmnopqrstuvwxyz'
95-
9694
$Objects = foreach ($number in 1..5) {
9795
[bigint]$number
9896
}
9997

10098
$CsvPath = "$TestDrive/Data.csv"
101-
$PipeDelimitedCsvPath = "$TestDrive/Data2.csv"
10299

103100
$Objects | Export-Csv -Path $CsvPath -NoTypeInformation
104101
$ImportedData = Import-Csv -Path $CsvPath
105102
}
106103

107104
It 'imports the stored data as PSCustomObjects' {
108105
# Our original data type is a .NET numeric type.
109-
'System.____.____' | Should -Be $Objects[0].GetType()
106+
'System.____.____' | Should -Be $Objects[0].GetType().FullName
110107

111-
$ImportedData | Should -NotBeNullOrEmpty
108+
$ImportedData | Should -Not -BeNullOrEmpty
112109

113110
# What comes back after the import?
114-
'System.____.____.____' | Should -Be $ImportedData[0].GetType()
111+
'System.____.____.____' | Should -Be $ImportedData[0].GetType().FullName
115112
}
116113

117114
It 'stores properties of an object, not any inherent value' {
@@ -150,7 +147,7 @@ Describe '*-Csv Cmdlets' {
150147

151148
$Animals = Import-Csv -Path $AnimalCsv -Delimiter $Delimiter
152149

153-
$Animals.Name | Should -NotBeNullOrEmpty
150+
$Animals.Name | Should -Not -BeNullOrEmpty
154151
$Animals[0].Animal | Should -Be 'Dog'
155152
$Animals[1].Name | Should -Be 'Alice'
156153

@@ -193,12 +190,12 @@ Describe '*-Csv Cmdlets' {
193190
}
194191

195192
It 'operates on string data rather than directly with files' {
196-
$CsvString = $Objects | ConvertTo-Csv
193+
$CsvString = $Objects | ConvertTo-Csv -NoTypeInformation
197194
$CsvString -is [____] | Should -BeTrue
198195
}
199196

200197
It 'works the same way as Export-Csv' {
201-
$CsvString = $Objects | ConvertTo-Csv
198+
$CsvString = $Objects | ConvertTo-Csv -NoTypeInformation
202199

203200
'"____","____"' | Should -Be $CsvString[0]
204201
'"__","__"' | Should -Be $CsvString[1]

0 commit comments

Comments
 (0)