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.

865 B
Raw Blame
import { describe, expect, it } from "vite-plus/test";
import { metadataWithDescription } from "./description-metadata.js";

describe("metadataWithDescription", () => {
  it("leaves metadata alone when it never held a description", () => {
    expect(metadataWithDescription(null, "New")).toBeUndefined();
    expect(metadataWithDescription({ theme: "dark" }, "New")).toBeUndefined();
  });

  it("replaces the description and keeps other keys", () => {
    expect(
      metadataWithDescription({ description: "Old", theme: "dark" }, ""),
    ).toEqual({ description: "", theme: "dark" });
  });

  it("reads metadata stored as a JSON string", () => {
    expect(
      metadataWithDescription('{"description":"Old"}', "Design team"),
    ).toEqual({ description: "Design team" });
    expect(metadataWithDescription("not json", "New")).toBeUndefined();
  });
});