Initial commit: SKEEN Derma Experts - Sistema Integral de Gestión Clínica
- Frontend React (SKEEN Brand) con Vite, TypeScript, Tailwind - Frontend Homenest (versión alternativa) - Módulos Odoo 17 custom (citas, pacientes, monedero, pagos, ventas, inventario, whatsapp) - WACRM fork (Next.js 16 + Supabase) - Hermes + Bridge + Skills (Qwen3.6 via Nan Builders) - Scripts de migración y operación - Documentación extensiva en docs/
This commit is contained in:
51
wacrm/src/lib/broadcast-status.test.ts
Normal file
51
wacrm/src/lib/broadcast-status.test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
broadcastStatusConfig,
|
||||
getBroadcastStatus,
|
||||
getRecipientStatus,
|
||||
recipientStatusConfig,
|
||||
} from "./broadcast-status";
|
||||
|
||||
describe("getBroadcastStatus", () => {
|
||||
it("returns the matching config for known statuses", () => {
|
||||
expect(getBroadcastStatus("sending")).toBe(broadcastStatusConfig.sending);
|
||||
expect(getBroadcastStatus("sent")).toBe(broadcastStatusConfig.sent);
|
||||
expect(getBroadcastStatus("failed")).toBe(broadcastStatusConfig.failed);
|
||||
});
|
||||
|
||||
it("flags `sending` as a live/pulsing state", () => {
|
||||
expect(getBroadcastStatus("sending").pulse).toBe(true);
|
||||
expect(getBroadcastStatus("sent").pulse).toBeFalsy();
|
||||
});
|
||||
|
||||
it("falls back to draft on an unknown status string", () => {
|
||||
expect(getBroadcastStatus("not-a-real-status")).toBe(
|
||||
broadcastStatusConfig.draft,
|
||||
);
|
||||
expect(getBroadcastStatus("")).toBe(broadcastStatusConfig.draft);
|
||||
});
|
||||
|
||||
it("each variant has the dark-theme class triple", () => {
|
||||
// Accept both fixed-shade Tailwind names (bg-red-500/10) and
|
||||
// token-backed names without a shade number (bg-primary/10) since
|
||||
// the brand-accent statuses now ride the active color theme.
|
||||
for (const v of Object.values(broadcastStatusConfig)) {
|
||||
expect(v.classes).toMatch(/bg-[a-z]+(-\d+)?\/10/);
|
||||
expect(v.classes).toMatch(/text-[a-z]+(-\d+)?/);
|
||||
expect(v.classes).toMatch(/border-[a-z]+(-\d+)?\/20/);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("getRecipientStatus", () => {
|
||||
it("returns the matching config for known statuses", () => {
|
||||
expect(getRecipientStatus("delivered")).toBe(
|
||||
recipientStatusConfig.delivered,
|
||||
);
|
||||
expect(getRecipientStatus("read")).toBe(recipientStatusConfig.read);
|
||||
});
|
||||
|
||||
it("falls back to pending on an unknown status string", () => {
|
||||
expect(getRecipientStatus("???")).toBe(recipientStatusConfig.pending);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user