UDT-011: Localización Temporal Argentina (infra transversal) #25
@@ -2,6 +2,7 @@
|
|||||||
// Modal de edición / creación de IngresosBrutos
|
// Modal de edición / creación de IngresosBrutos
|
||||||
// CRÍTICO: NO incluye campo Alícuota en modo edit (inmutable, cambiar via NuevaVersion)
|
// CRÍTICO: NO incluye campo Alícuota en modo edit (inmutable, cambiar via NuevaVersion)
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
import { todayArgentina } from '@/lib/dateFormat'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
import { zodResolver } from '@hookform/resolvers/zod'
|
import { zodResolver } from '@hookform/resolvers/zod'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
@@ -96,7 +97,7 @@ export function IngresosBrutosFormModal({
|
|||||||
descripcion: '',
|
descripcion: '',
|
||||||
activo: true,
|
activo: true,
|
||||||
alicuotaCreate: undefined,
|
alicuotaCreate: undefined,
|
||||||
vigenciaDesde: '',
|
vigenciaDesde: todayArgentina(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ export function IngresosBrutosFormModal({
|
|||||||
descripcion: '',
|
descripcion: '',
|
||||||
activo: true,
|
activo: true,
|
||||||
alicuotaCreate: undefined,
|
alicuotaCreate: undefined,
|
||||||
vigenciaDesde: '',
|
vigenciaDesde: todayArgentina(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
createMutation.reset()
|
createMutation.reset()
|
||||||
@@ -152,7 +153,7 @@ export function IngresosBrutosFormModal({
|
|||||||
provincia: values.provincia as ProvinciaArgentina,
|
provincia: values.provincia as ProvinciaArgentina,
|
||||||
descripcion: values.descripcion,
|
descripcion: values.descripcion,
|
||||||
alicuota: values.alicuotaCreate,
|
alicuota: values.alicuotaCreate,
|
||||||
vigenciaDesde: values.vigenciaDesde ?? new Date().toISOString().slice(0, 10),
|
vigenciaDesde: values.vigenciaDesde ?? todayArgentina(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// T600.20-T600.29 (IIBB) — TDD: IngresosBrutosFormModal
|
// T600.20-T600.29 (IIBB) — TDD: IngresosBrutosFormModal
|
||||||
// CRÍTICO: verifica que el modal de Editar NO tiene campo Alícuota [REQ-UI-007]
|
// CRÍTICO: verifica que el modal de Editar NO tiene campo Alícuota [REQ-UI-007]
|
||||||
|
// T600.10 — BUG-FE-03 regression: default vigenciaDesde usa todayArgentina (no UTC)
|
||||||
import { describe, it, expect, vi } from 'vitest'
|
import { describe, it, expect, vi } from 'vitest'
|
||||||
import { render, screen, waitFor } from '@testing-library/react'
|
import { render, screen, waitFor } from '@testing-library/react'
|
||||||
import userEvent from '@testing-library/user-event'
|
import userEvent from '@testing-library/user-event'
|
||||||
@@ -91,3 +92,21 @@ describe('IngresosBrutosFormModal — CRÍTICO: sin campo Alícuota en modo EDIT
|
|||||||
expect(onClose).toHaveBeenCalledTimes(1)
|
expect(onClose).toHaveBeenCalledTimes(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('IngresosBrutosFormModal — BUG-FE-03 regression: vigenciaDesde usa todayArgentina', () => {
|
||||||
|
// A las 22:30 ART del 30/04, UTC ya es 01:30 del 01/05.
|
||||||
|
// new Date().toISOString().slice(0,10) devolvería "2026-05-01" (UTC) — INCORRECTO.
|
||||||
|
// todayArgentina() debe devolver "2026-04-30" — CORRECTO.
|
||||||
|
it('modo create: campo vigenciaDesde refleja fecha ART, no UTC, a las 22:30 ART del 30/04', () => {
|
||||||
|
vi.useFakeTimers()
|
||||||
|
vi.setSystemTime(new Date('2026-05-01T01:30:00.000Z')) // 22:30 ART del 30/04
|
||||||
|
|
||||||
|
renderModal({ item: null })
|
||||||
|
|
||||||
|
const vigenciaInput = screen.getByLabelText(/vigencia desde/i) as HTMLInputElement
|
||||||
|
// El input debe tener value="2026-04-30" (fecha ART), no "2026-05-01" (UTC)
|
||||||
|
expect(vigenciaInput.value).toBe('2026-04-30')
|
||||||
|
|
||||||
|
vi.useRealTimers()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user