Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

1.1 KB
Raw Blame
import { render, screen } from "@testing-library/react";
import type { ForwardedRef } from "react";
import { forwardRef } from "react";
import { describe, expect, it, vi } from "vitest";

vi.mock("react-force-graph-3d", () => ({
  default: forwardRef(function ForceGraph3DStub(
    props: { backgroundColor?: string },
    _ref: ForwardedRef<unknown>,
  ) {
    return (
      <canvas
        data-testid="force-graph-3d"
        data-background-color={props.backgroundColor}
      />
    );
  }),
}));

vi.mock("@/hooks/useGraphOrbit", () => ({
  useGraphOrbit: vi.fn(),
}));

import { WikiGraph3D } from "@/components/wiki/WikiGraph3D";

describe("3D graph stage transparency", () => {
  it("lets the app ground show through the Wiki graph canvas", () => {
    render(
      <WikiGraph3D
        graphData={{ nodes: [], links: [] }}
        width={800}
        height={600}
        onNodeClick={vi.fn()}
        resetSignal={0}
        nodeLabel={() => ""}
        linkLabel={() => ""}
      />,
    );

    expect(
      screen
        .getByTestId("force-graph-3d")
        .getAttribute("data-background-color"),
    ).toBe("rgba(0,0,0,0)");
  });
});