555e282cc4
ci / changelog_check (push) Waiting to run
ci / check_changes (push) Waiting to run
ci / build_mem0 (3.10) (push) Blocked by required conditions
ci / build_mem0 (3.11) (push) Blocked by required conditions
ci / build_mem0 (3.12) (push) Blocked by required conditions
CLI Node CI / lint (push) Waiting to run
CLI Node CI / test (20) (push) Waiting to run
CLI Node CI / test (22) (push) Waiting to run
CLI Node CI / build (push) Waiting to run
CLI Python CI / lint (push) Waiting to run
CLI Python CI / test (3.10) (push) Waiting to run
CLI Python CI / test (3.11) (push) Waiting to run
CLI Python CI / test (3.12) (push) Waiting to run
CLI Python CI / build (push) Waiting to run
openclaw checks / lint (push) Waiting to run
openclaw checks / test (20) (push) Waiting to run
openclaw checks / test (22) (push) Waiting to run
openclaw checks / build (push) Waiting to run
opencode-plugin checks / build (push) Waiting to run
pi-agent-plugin checks / lint (push) Waiting to run
pi-agent-plugin checks / test (20) (push) Waiting to run
pi-agent-plugin checks / test (22) (push) Waiting to run
pi-agent-plugin checks / build (push) Waiting to run
TypeScript SDK CI / check_changes (push) Waiting to run
TypeScript SDK CI / changelog_check (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (22) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (22) (push) Blocked by required conditions
99 lines
2.2 KiB
TypeScript
99 lines
2.2 KiB
TypeScript
/**
|
|
* Tests for branding utilities.
|
|
*/
|
|
|
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
import {
|
|
BRAND_COLOR,
|
|
SUCCESS_COLOR,
|
|
ERROR_COLOR,
|
|
TAGLINE,
|
|
LOGO_MINI,
|
|
printSuccess,
|
|
printError,
|
|
printWarning,
|
|
printInfo,
|
|
printScope,
|
|
} from "../src/branding.js";
|
|
|
|
let output: string;
|
|
let errOutput: string;
|
|
const originalLog = console.log;
|
|
const originalError = console.error;
|
|
|
|
beforeEach(() => {
|
|
output = "";
|
|
errOutput = "";
|
|
console.log = (...args: unknown[]) => {
|
|
output += args.map(String).join(" ") + "\n";
|
|
};
|
|
console.error = (...args: unknown[]) => {
|
|
errOutput += args.map(String).join(" ") + "\n";
|
|
};
|
|
});
|
|
|
|
afterEach(() => {
|
|
console.log = originalLog;
|
|
console.error = originalError;
|
|
});
|
|
|
|
describe("branding constants", () => {
|
|
it("has correct brand color", () => {
|
|
expect(BRAND_COLOR).toBe("#8b5cf6");
|
|
});
|
|
|
|
it("has correct tagline", () => {
|
|
expect(TAGLINE).toBe("The Memory Layer for AI Agents");
|
|
});
|
|
|
|
it("has correct logo mini", () => {
|
|
expect(LOGO_MINI).toBe("◆ mem0");
|
|
});
|
|
});
|
|
|
|
describe("printSuccess", () => {
|
|
it("prints success message", () => {
|
|
printSuccess("Operation completed");
|
|
expect(output).toContain("Operation completed");
|
|
});
|
|
});
|
|
|
|
describe("printError", () => {
|
|
it("prints error message to stderr", () => {
|
|
printError("Something failed");
|
|
expect(errOutput).toContain("Something failed");
|
|
});
|
|
|
|
it("prints hint when provided to stderr", () => {
|
|
printError("Failed", "Try again");
|
|
expect(errOutput).toContain("Try again");
|
|
});
|
|
});
|
|
|
|
describe("printWarning", () => {
|
|
it("prints warning message to stderr", () => {
|
|
printWarning("Be careful");
|
|
expect(errOutput).toContain("Be careful");
|
|
});
|
|
});
|
|
|
|
describe("printInfo", () => {
|
|
it("prints info message", () => {
|
|
printInfo("Important note");
|
|
expect(errOutput).toContain("Important note");
|
|
});
|
|
});
|
|
|
|
describe("printScope", () => {
|
|
it("prints scope when IDs present", () => {
|
|
printScope({ user_id: "alice", agent_id: "bot" });
|
|
expect(errOutput).toContain("alice");
|
|
expect(errOutput).toContain("bot");
|
|
});
|
|
|
|
it("prints nothing when no IDs", () => {
|
|
printScope({});
|
|
expect(errOutput).toBe("");
|
|
});
|
|
});
|