Add tsoa create endpoints for orgs users and projects
This commit is contained in:
@@ -83,6 +83,76 @@ describe("mock task API", () => {
|
||||
expect(response.body.organizations).toHaveLength(3);
|
||||
});
|
||||
|
||||
it("creates an organization through the HTTP contract", async () => {
|
||||
const app = createTestApp();
|
||||
|
||||
const response = await sendRequest(app, {
|
||||
method: "POST",
|
||||
url: "/orgs",
|
||||
body: {
|
||||
slug: "globex-systems",
|
||||
name: "Globex Systems",
|
||||
plan: "growth",
|
||||
industry: "Manufacturing",
|
||||
},
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
expect(response.status).toBe(201);
|
||||
expect(response.body.organization.slug).toBe("globex-systems");
|
||||
expect(response.body.organization.name).toBe("Globex Systems");
|
||||
});
|
||||
|
||||
it("creates a user through the HTTP contract", async () => {
|
||||
const app = createTestApp();
|
||||
|
||||
const response = await sendRequest(app, {
|
||||
method: "POST",
|
||||
url: "/users",
|
||||
body: {
|
||||
orgId: "org_acme",
|
||||
fullName: "Iris Quinn",
|
||||
email: "iris@acme.example",
|
||||
role: "engineer",
|
||||
timezone: "Europe/Dublin",
|
||||
},
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
expect(response.status).toBe(201);
|
||||
expect(response.body.user.orgId).toBe("org_acme");
|
||||
expect(response.body.user.email).toBe("iris@acme.example");
|
||||
});
|
||||
|
||||
it("creates a project through the HTTP contract", async () => {
|
||||
const app = createTestApp();
|
||||
|
||||
const response = await sendRequest(app, {
|
||||
method: "POST",
|
||||
url: "/projects",
|
||||
body: {
|
||||
orgId: "org_acme",
|
||||
key: "BIZ",
|
||||
name: "Business Ops Dashboard",
|
||||
status: "planning",
|
||||
ownerUserId: "user_acme_1",
|
||||
dueDate: "2026-06-30",
|
||||
},
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
expect(response.status).toBe(201);
|
||||
expect(response.body.project.orgId).toBe("org_acme");
|
||||
expect(response.body.project.key).toBe("BIZ");
|
||||
expect(response.body.project.ownerUserId).toBe("user_acme_1");
|
||||
});
|
||||
|
||||
it("filters tasks by org and status", async () => {
|
||||
const app = createTestApp();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user