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.1 KB
Raw Blame
import { describe, expect, it } from "vite-plus/test";
import { makeUi } from "../render/ui.js";
import { renderAttached } from "./render-attached.js";

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

describe("renderAttached", () => {
  const attached = { label: "KAN-1", url: "https://kaneo.test/t" };

  it("names one or two files and counts more", () => {
    expect(
      renderAttached(ui, {
        ...attached,
        names: ["shot.png"],
        target: "description",
      }),
    ).toEqual([
      "  ✓ Attached shot.png to KAN-1 · added to the description",
      "",
    ]);
    expect(
      renderAttached(ui, {
        ...attached,
        names: ["a.png", "b.pdf"],
        target: "comment",
      })[0],
    ).toBe("  ✓ Attached a.png and b.pdf to KAN-1 · posted as a comment");
    expect(
      renderAttached(ui, {
        ...attached,
        names: ["a", "b", "c"],
        target: "comment",
      })[0],
    ).toBe("  ✓ Attached 3 files to KAN-1 · posted as a comment");
  });
});