Files
KArtSell.Aegis/frontend/src/shared/ui/tests/gridColumnAdapter.spec.ts
T
kjh2064 3f293d8aa8
deploy / deploy (push) Successful in 1m52s
deploy / notify (push) Successful in 1s
V13-FE-006: consolidate approved UI and contract hardening
2026-08-13 02:41:00 +09:00

40 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { toUiGridColumns } from '../gridColumnAdapter'
describe('toUiGridColumns', () => {
it('preserves the provider-neutral column semantics and formatter', () => {
const formatter = (value: unknown) => String(value ?? '')
expect(toUiGridColumns([{
field: 'modelId',
header: 'Model ID',
width: 150,
sortable: false,
filterable: true,
formatter,
}])).toEqual([{
field: 'modelId',
header: 'Model ID',
width: 150,
sortable: false,
filterable: true,
formatter,
}])
})
it('does not guess how string widths should be interpreted', () => {
expect(toUiGridColumns([{ field: 'name', header: 'Name', width: '20rem' }])).toEqual([{
field: 'name',
header: 'Name',
width: undefined,
sortable: undefined,
filterable: undefined,
formatter: undefined,
}])
})
it('rejects non-string fields before they reach an adapter', () => {
expect(() => toUiGridColumns([{ field: 1, header: 'Invalid' }])).toThrow('Grid column field must be a string')
})
})