M8-T19: add scope-aware energy contract and cost UI
This commit is contained in:
@@ -150,6 +150,17 @@ describe('useCreateContract', () => {
|
||||
|
||||
expect(mockPost).toHaveBeenCalledWith('/api/energy/contracts', { body })
|
||||
})
|
||||
|
||||
it('preserves the caller-selected thermal scope in the typed create payload', async () => {
|
||||
mockPost.mockResolvedValue({ data: { id: 9 } })
|
||||
const { Wrapper } = makeWrapper()
|
||||
const { useCreateContract } = await import('./hooks')
|
||||
const { result } = renderHook(() => useCreateContract(), { wrapper: Wrapper })
|
||||
await act(async () => {
|
||||
await result.current.mutateAsync({ name: 'Heat', kind: 'district_heating', scope: 'thermal', currency: 'EUR', values: {} })
|
||||
})
|
||||
expect(mockPost).toHaveBeenCalledWith('/api/energy/contracts', expect.objectContaining({ body: expect.objectContaining({ scope: 'thermal' }) }))
|
||||
})
|
||||
})
|
||||
|
||||
describe('useEnergyPrices', () => {
|
||||
|
||||
Reference in New Issue
Block a user