Skip to content

Commit bf86df6

Browse files
authored
Fix datatype issue in percent output resulting in sorting issue (#20)
* Fix #19 * Fix Pester tests for issue Bug: Some cases selecting lowest emissions reading returns the wrong region #19
1 parent 6d75df3 commit bf86df6

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

PSScriptAnalyzerSettings.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@{
2-
ExcludeRules = @('PSAvoidUsingPlainTextForPassword')
2+
ExcludeRules = @('PSAvoidUsingPlainTextForPassword','PSAvoidUsingUsernameAndPasswordParams')
33
}

src/PSWattTime/PSWattTime.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'PSWattTime.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.0.4.0'
15+
ModuleVersion = '1.0.5.0'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -114,7 +114,7 @@ PrivateData = @{
114114
# IconUri = ''
115115

116116
# ReleaseNotes of this module
117-
ReleaseNotes = 'Updates to documentation and PowerShell internal help'
117+
ReleaseNotes = 'Fix return datatype for percent of each function'
118118

119119
# Prerelease string of this module
120120
# Prerelease = ''

src/PSWattTime/PSWattTime.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function Get-WattTime {
9090
ba = $ba
9191
}
9292
$wattTime = Invoke-RestMethod -Uri 'https://api2.watttime.org/v2/index/' -Method Get -Headers $headers -Body $params -ContentType 'application/json'
93+
$wattTime.percent = [int]($wattTime.percent)
9394
return $wattTime
9495
}
9596

tests/PSWattTime.Tests/PSWattTime.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Describe "PSWattTimeTests" {
102102
}
103103

104104
It "Should return a PSCustomObject with a percent property with a value" {
105-
$wattTime.percent | Should -BeOfType 'string'
105+
$wattTime.percent | Should -BeOfType 'int'
106106
}
107107
}
108108

@@ -141,7 +141,7 @@ Describe "PSWattTimeTests" {
141141
}
142142

143143
It "Should return a PSCustomObject with a percent property with a value" {
144-
$wattTime.percent | Should -BeOfType 'string'
144+
$wattTime.percent | Should -BeOfType 'int'
145145
}
146146
}
147147
Context "When we register an account" {

0 commit comments

Comments
 (0)