Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  zod-schema.providers-whatsapp.test.ts

  Sprache: JAVA
 

import { describe, it, expect } from "vitest";
import { WhatsAppConfigSchema, WhatsAppAccountSchema } from "./zod-schema.providers-whatsapp.js";

describe("WhatsApp prompt config Zod validation", () => {
  it("validates group-level systemPrompt", () => {
    const config = {
      groups: {
        "123@g.us": {
          systemPrompt: "This is a work group",
        },
      },
    };

    const result = WhatsAppConfigSchema.safeParse(config);
    expect(result.success).toBe(true);
    if (result.success) {
      expect(result.data.groups?.["123@g.us"]?.systemPrompt).toBe("This is a work group");
    }
  });

  it("validates direct-level systemPrompt", () => {
    const config = {
      direct: {
        "+15551234567": {
          systemPrompt: "This is a VIP direct chat",
        },
      },
    };

    const result = WhatsAppConfigSchema.safeParse(config);
    expect(result.success).toBe(true);
    if (result.success) {
      expect(result.data.direct?.["+15551234567"]?.systemPrompt).toBe("This is a VIP direct chat");
    }
  });

  it("validates combined group and direct prompt surfaces", () => {
    const config = {
      groups: {
        "*": {
          systemPrompt: "Default group prompt",
        },
      },
      direct: {
        "+15551234567": {
          systemPrompt: "Direct VIP",
        },
      },
      accounts: {
        work: {
          groups: {
            "456@g.us": {
              systemPrompt: "Project team",
            },
          },
          direct: {
            "*": {
              systemPrompt: "Work direct default",
            },
          },
        },
      },
    };

    const result = WhatsAppConfigSchema.safeParse(config);
    expect(result.success).toBe(true);
    if (result.success) {
      expect(result.data.groups?.["*"]?.systemPrompt).toBe("Default group prompt");
      expect(result.data.direct?.["+15551234567"]?.systemPrompt).toBe("Direct VIP");
      expect(result.data.accounts?.work?.groups?.["456@g.us"]?.systemPrompt).toBe("Project team");
      expect(result.data.accounts?.work?.direct?.["*"]?.systemPrompt).toBe("Work direct default");
    }
  });

  it("validates WhatsAppAccountSchema directly", () => {
    const accountConfig = {
      name: "Personal Account",
      groups: {
        "family@g.us": {
          systemPrompt: "Keep responses family-friendly",
        },
      },
      direct: {
        "+15557654321": {
          systemPrompt: "Keep responses concise",
        },
      },
    };

    const result = WhatsAppAccountSchema.safeParse(accountConfig);
    expect(result.success).toBe(true);
    if (result.success) {
      expect(result.data.groups?.["family@g.us"]?.systemPrompt).toBe(
        "Keep responses family-friendly",
      );
      expect(result.data.direct?.["+15557654321"]?.systemPrompt).toBe("Keep responses concise");
    }
  });
});

Messung V0.5 in Prozent
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik