Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

949 B
Raw Blame
import { describe, expect, it } from "vitest";
import { specularTransform } from "@/components/mascot-motion";
import { setComposerFocused } from "./composer-focus";

describe("specularTransform", () => {
  it("returns null at rest so resting mascots write zero gradient attributes", () => {
    expect(specularTransform(0, 0, 0)).toBeNull();
    expect(specularTransform(0.001, 0.001, 0)).toBeNull();
  });

  it("counter-shifts the gradient highlight when gazing or leaning", () => {
    expect(specularTransform(1, 0, 0)).toBe("translate(-0.140 0.000)");
    expect(specularTransform(0, 0.5, 0)).toBe("translate(0.000 -0.070)");
    expect(specularTransform(-0.5, -0.5, 0)).toBe("translate(0.070 0.070)");
  });
});

describe("composer-focus", () => {
  it("handles missing thread ids safely", () => {
    expect(() => setComposerFocused(null, true)).not.toThrow();
    expect(() => setComposerFocused(undefined, false)).not.toThrow();
  });
});