Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

1.3 KB
Raw Blame
import { describe, expect, it } from "vite-plus/test";
import { makeUi } from "../render/ui.js";
import { renderDoctor } from "./render-doctor.js";

const ui = makeUi({
  color: 0,
  unicode: true,
  hyperlinks: false,
  animate: false,
  columns: 80,
});

describe("renderDoctor", () => {
  it("prints one line per check and lists missing operations", () => {
    expect(
      renderDoctor(ui, {
        checks: [
          {
            name: "server",
            ok: true,
            detail: "localhost:1337 responded in 4 ms",
          },
          {
            name: "compatibility",
            ok: false,
            detail: "Missing 1 of 80 operations",
            missing: ["PUT /api/task/title/{id}"],
          },
        ],
      }),
    ).toEqual([
      "",
      "  ✓ Server             localhost:1337 responded in 4 ms",
      "  ✗ API compatibility  Missing 1 of 80 operations",
      "                       PUT /api/task/title/{id}",
      "",
      "  ✗ 1 of 2 checks failed",
      "",
    ]);
  });

  it("confirms when everything passes", () => {
    expect(
      renderDoctor(ui, {
        checks: [
          {
            name: "config",
            ok: true,
            detail: "/home/a/.config/kaneo/config.json",
          },
        ],
      }).at(-2),
    ).toBe("  ✓ Everything looks good");
  });
});