feat(cotizador): multi-desarrollo — ATELIER, ESTANZA, SENDA, SOLANA + DIAGONAL
- Motor de cálculo parametrizado por desarrollo (enganches, descuentos, splits, fuente de N, quirk Infonavit-lista); DIAGONAL byte-idéntico - 285 unidades (5 desarrollos) en seeds, API (?desarrollo=) y board Monday - Selector de desarrollo en UI, propuestas por config, PDF multi-desarrollo - Knowledge IA: catálogo por desarrollo + matriz de diferencias (10 docs) - Tests: cotizador 53, api 99 — fixtures de los Excel validados al centavo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, afterEach } from 'vitest'
|
||||
import { getUnidades } from './api'
|
||||
import { UNIDADES_SEED } from '../data/unidades'
|
||||
import { INVENTARIO_SEED } from '../data/unidades'
|
||||
import type { Unidad } from '../types'
|
||||
|
||||
const unidadApi: Unidad = {
|
||||
@@ -50,7 +50,7 @@ describe('getUnidades', () => {
|
||||
const resultado = await getUnidades()
|
||||
|
||||
expect(resultado.usandoSeed).toBe(true)
|
||||
expect(resultado.unidades).toEqual(UNIDADES_SEED)
|
||||
expect(resultado.unidades).toEqual(INVENTARIO_SEED)
|
||||
expect(warn).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
@@ -61,7 +61,7 @@ describe('getUnidades', () => {
|
||||
const resultado = await getUnidades()
|
||||
|
||||
expect(resultado.usandoSeed).toBe(true)
|
||||
expect(resultado.unidades).toEqual(UNIDADES_SEED)
|
||||
expect(resultado.unidades).toEqual(INVENTARIO_SEED)
|
||||
expect(warn).toHaveBeenCalledOnce()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Unidad } from '../types'
|
||||
import { UNIDADES_SEED } from '../data/unidades'
|
||||
import { INVENTARIO_SEED } from '../data/unidades'
|
||||
|
||||
// TODO produccion: '/api' same-origin detras de NGINX
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
@@ -23,6 +23,6 @@ export async function getUnidades(): Promise<GetUnidadesResult> {
|
||||
return { unidades, usandoSeed: false }
|
||||
} catch (err) {
|
||||
console.warn('[api] No se pudo obtener el inventario del API; usando seed local.', err)
|
||||
return { unidades: UNIDADES_SEED, usandoSeed: true }
|
||||
return { unidades: INVENTARIO_SEED, usandoSeed: true }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user