Sacar pestaña Test del admin

- Borrado public/components/test-panel.js + su nav button + su rango de
  router + sus rutas /test/products-with-stock y /test/order.
- Borrados handleGetProductsWithStock + handleCreateTestOrder y los
  api wrappers getProductsWithStock + createTestOrder. Ya no se usan en
  ningún flujo: pruebas de bot se hacen vía simulator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lucas Tettamanti
2026-05-02 17:29:20 -03:00
parent c93955fa55
commit 3c70eb5ff7
8 changed files with 3 additions and 501 deletions

View File

@@ -1,5 +1,4 @@
import { createOrder, syncOrdersIncremental } from "../../4-woo-orders/wooOrders.js";
import { listProducts } from "../db/repo.js";
import { syncOrdersIncremental } from "../../4-woo-orders/wooOrders.js";
import * as ordersRepo from "../../4-woo-orders/ordersRepo.js";
/**
@@ -24,51 +23,3 @@ export async function handleListOrders({ tenantId, page = 1, limit = 50 }) {
};
}
/**
* Obtiene productos con stock para testing
*/
export async function handleGetProductsWithStock({ tenantId }) {
const allProducts = await listProducts({ tenantId, limit: 500 });
const withStock = allProducts.filter(p =>
p.stock_status === "instock" &&
p.price &&
Number(p.price) > 0
);
return { items: withStock };
}
/**
* Crea una orden de prueba en WooCommerce
*/
export async function handleCreateTestOrder({ tenantId, basket, address, wa_chat_id }) {
if (!basket?.items?.length) {
throw new Error("basket_empty");
}
const order = await createOrder({
tenantId,
wooCustomerId: null, // Sin customer de Woo para testing
basket,
address,
run_id: `test-${Date.now()}`,
});
// Calcular total desde line_items
let total = 0;
if (order?.raw?.line_items) {
for (const item of order.raw.line_items) {
total += Number(item.total) || 0;
}
} else if (order?.raw?.total) {
total = Number(order.raw.total) || 0;
}
return {
ok: true,
woo_order_id: order?.id || null,
total,
line_items: order?.line_items || [],
raw: order?.raw || null,
};
}