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.

844 B
Raw Blame
import { QueryClient } from "@tanstack/react-query";
import { describe, expect, it } from "vite-plus/test";
import { collectCachedProjects } from "./collect-cached-projects";

describe("collectCachedProjects", () => {
  it("gathers projects from every cached list and single project query", () => {
    const client = new QueryClient();
    client.setQueryData(["projects", "ws"], [{ id: "active" }]);
    client.setQueryData(
      ["projects", "ws", "including-archived"],
      [{ id: "active" }, { id: "archived" }],
    );
    client.setQueryData(["projects", "ws", "visited"], { id: "visited" });
    client.setQueryData(["projects", "other"], [{ id: "elsewhere" }]);

    expect(
      collectCachedProjects(client, "ws")
        .map((project) => project.id)
        .sort(),
    ).toEqual(["active", "archived", "visited"]);
  });
});