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 { createApp } from "../../../../apps/api/src/index";
import { expect } from "vite-plus/test";
import { signUpWithSession } from "../auth-session";
import { createProjectFixture } from "../fixtures";
import { projectAccessApi } from "./project-access-api";

export async function createInvitationWorkspace() {
  const { app } = createApp();
  const owner = await signUpWithSession(app, {
    email: "[email protected]",
    name: "Owner",
  });
  const ownerRequest = projectAccessApi({ cookie: owner.cookies });
  const created = await ownerRequest("/auth/organization/create", {
    method: "POST",
    body: { name: "Agency", slug: "agency" },
  });
  expect(created.status).toBe(200);
  const workspace = (await created.json()) as { id: string };
  const alpha = await createProjectFixture({
    workspaceId: workspace.id,
    name: "Alpha",
    slug: "alpha",
  });
  const beta = await createProjectFixture({
    workspaceId: workspace.id,
    name: "Beta",
    slug: "beta",
  });
  return {
    app,
    ownerRequest,
    workspaceId: workspace.id,
    alpha: alpha.project,
    beta: beta.project,
  };
}