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.

817 B
Raw Blame
import { describe, expect, it, vi } from "vite-plus/test";

vi.mock("../../../apps/api/src/plugins/gitlab/utils/gitlab-api", () => ({
  verifyGitlabToken: () => Promise.reject(new Error("GitLab API error 401")),
  createGitlabClient: () => ({ listMemberProjects: () => Promise.resolve([]) }),
}));

const { default: listGitlabProjects } =
  await import("../../../apps/api/src/gitlab-integration/controllers/list-gitlab-projects");

describe("listGitlabProjects", () => {
  it("reports a rejected GitLab token as an integration auth failure", async () => {
    await expect(
      listGitlabProjects({
        baseUrl: "https://gitlab.com",
        accessToken: "token",
        tokenType: "private",
      }),
    ).rejects.toMatchObject({
      status: 401,
      code: "INTEGRATION_AUTH_FAILED",
    });
  });
});