Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Morecast Validation Tweak #3962

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/src/features/moreCast2/components/MoreCast2Column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const windDirForecastField = new IndeterminateField(
)

export const rhForecastField = new IndeterminateField('rh', RH_HEADER, 'number', 0, true, (value: string) => {
return Number(value) < 0 || Number(value) > 100 ? 'RH must be between 0 and 100' : ''
return Number(value) < 1 || Number(value) > 100 ? 'RH must be between 1 and 100' : ''
})
export const windSpeedForecastField = new IndeterminateField(
'windSpeed',
Expand All @@ -203,7 +203,7 @@ export const windSpeedForecastField = new IndeterminateField(
0,
true,
(value: string) => {
return Number(value) < 0 || Number(value) > 120 ? 'Wind speed must be between 0 and 120 kph' : ''
return Number(value) < 0 || Number(value) > 99 ? 'Wind speed must be between 0 and 99 kph' : ''
}
)
export const precipForecastField = new IndeterminateField(
Expand Down
12 changes: 6 additions & 6 deletions web/src/features/moreCast2/components/moreCast2Column.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ describe('MoreCast2Column', () => {
)
})
it('should have correct validation logic', () => {
expect(rhForecastField.validator && rhForecastField.validator('101')).toEqual('RH must be between 0 and 100')
expect(rhForecastField.validator && rhForecastField.validator('101')).toEqual('RH must be between 1 and 100')

expect(rhForecastField.validator && rhForecastField.validator('-1')).toEqual('RH must be between 0 and 100')
expect(rhForecastField.validator && rhForecastField.validator('-1')).toEqual('RH must be between 1 and 100')

expect(rhForecastField.validator && rhForecastField.validator('0')).toEqual('')
expect(rhForecastField.validator && rhForecastField.validator('1')).toEqual('')
})
})
describe('WindDirForecastField', () => {
Expand Down Expand Up @@ -153,12 +153,12 @@ describe('MoreCast2Column', () => {
)
})
it('should have correct validation logic', () => {
expect(windSpeedForecastField.validator && windSpeedForecastField.validator('121')).toEqual(
'Wind speed must be between 0 and 120 kph'
expect(windSpeedForecastField.validator && windSpeedForecastField.validator('100')).toEqual(
'Wind speed must be between 0 and 99 kph'
)

expect(windSpeedForecastField.validator && windSpeedForecastField.validator('-1')).toEqual(
'Wind speed must be between 0 and 120 kph'
'Wind speed must be between 0 and 99 kph'
)

expect(windSpeedForecastField.validator && windSpeedForecastField.validator('0')).toEqual('')
Expand Down
Loading