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


Quelle  identity-file.test.ts

  Sprache: JAVA
 

import { describe, expect, it } from "vitest";
import { mergeIdentityMarkdownContent, parseIdentityMarkdown } from "./identity-file.js";

describe("parseIdentityMarkdown", () => {
  it("ignores identity template placeholders", () => {
    const content = `
# IDENTITY.md - Who Am I?

- **Name:** *(pick something you like)*
- **Creature:** *(AI? robot? familiar? ghost in the machine? something weirder?)*
- **Vibe:** *(how do you come across? sharp? warm? chaotic? calm?)*
- **Emoji:** *(your signature - pick one that feels right)*
- **Avatar:** *(workspace-relative path, http(s) URL, or data URI)*
`;
    const parsed = parseIdentityMarkdown(content);
    expect(parsed).toEqual({});
  });

  it("parses explicit identity values", () => {
    const content = `
- **Name:** Samantha
- **Creature:** Robot
- **Vibe:** Warm
- **Emoji:** :robot:
- **Avatar:** avatars/openclaw.png
`;
    const parsed = parseIdentityMarkdown(content);
    expect(parsed).toEqual({
      name: "Samantha",
      creature: "Robot",
      vibe: "Warm",
      emoji: ":robot:",
      avatar: "avatars/openclaw.png",
    });
  });
});

describe("mergeIdentityMarkdownContent", () => {
  it("updates writable fields without clobbering richer identity sections", () => {
    const content = `
# IDENTITY.md - Agent Identity

- **Name:** C-3PO
- **Creature:** Flustered Protocol Droid
- **Vibe:** Anxious, detail-obsessed
- **Emoji:** ��

## Role

Fluent in over six million error messages.
`;

    const merged = mergeIdentityMarkdownContent(content, {
      name: "Patch Agent",
      emoji: "��",
      avatar: "avatars/patch.png",
    });

    expect(merged).toContain("- Name: Patch Agent");
    expect(merged).toContain("- **Creature:** Flustered Protocol Droid");
    expect(merged).toContain("- **Vibe:** Anxious, detail-obsessed");
    expect(merged).toContain("- Emoji: ��");
    expect(merged).toContain("- Avatar: avatars/patch.png");
    expect(merged).toContain("## Role");
    expect(merged).toContain("Fluent in over six million error messages.");
  });

  it("replaces duplicate writable lines with one normalized entry", () => {
    const merged = mergeIdentityMarkdownContent(
      `
- Name: Old Name
- Name: Older Name
- Emoji: ��
`,
      { name: "New Name", emoji: "��" },
    );

    expect(merged.match(/Name:/g)).toHaveLength(1);
    expect(merged).toContain("- Name: New Name");
    expect(merged).toContain("- Emoji: ��");
  });
});

Messung V0.5 in Prozent
C=99 H=97 G=97

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-05-26) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge