Skip to content

Commit

Permalink
test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
brettedw committed Feb 13, 2024
1 parent 2b0a70b commit 538d8a5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
28 changes: 24 additions & 4 deletions web/src/features/moreCast2/components/colDefBuilder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('ColDefBuilder', () => {
})
)
})
it('should generate all col defs correcty', () => {
it('should generate all col defs correctly', () => {
const colDefs = colDefBuilder.generateColDefs()

const expected = [
Expand All @@ -62,7 +62,7 @@ describe('ColDefBuilder', () => {
headerName: determinate,
sortable: false,
type: 'number',
width: DEFAULT_COLUMN_WIDTH
width: determinate === WeatherDeterminate.ACTUAL ? DEFAULT_FORECAST_COLUMN_WIDTH : DEFAULT_COLUMN_WIDTH
})
)
)
Expand Down Expand Up @@ -146,14 +146,34 @@ describe('ColDefBuilder', () => {
)
expect(
forecastColDef.renderCell({ row: { testField: { choice: ModelChoice.GDPS, value: 1 } }, formattedValue: 1 })
).toEqual(<TextField disabled={false} label={ModelChoice.GDPS} size="small" value={1} />)
).toEqual(
<TextField
disabled={false}
InputLabelProps={{
shrink: true
}}
label={ModelChoice.GDPS}
size="small"
value={1}
/>
)

expect(
forecastColDef.renderCell({
row: { testField: { choice: ModelChoice.GDPS, value: 1 }, testActual: 2 },
formattedValue: 1
})
).toEqual(<TextField disabled={false} label={ModelChoice.GDPS} size="small" value={1} />)
).toEqual(
<TextField
disabled={false}
InputLabelProps={{
shrink: true
}}
label={ModelChoice.GDPS}
size="small"
value={1}
/>
)
expect(forecastColDef.valueFormatter({ value: 1.11 })).toEqual('1.1')
expect(
forecastColDef.valueGetter({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,4 @@ describe('GridComponentRenderer', () => {
const actualField = gridComponentRenderer.getActualField('testForecast')
expect(actualField).toEqual('testActual')
})

it('should return an actual over a prediction if it exists', () => {
const itemValue = gridComponentRenderer.valueGetter(
{
row: {
testForecast: { choice: ModelChoice.GDPS, value: 1.11 },
testActual: 2.22
},
value: { choice: ModelChoice.GDPS, value: 1.11 }
},
1,
'testForecast'
)
expect(itemValue).toEqual('2.2')
})
})

0 comments on commit 538d8a5

Please sign in to comment.