Skip to content

Commit

Permalink
Make test more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
joeauyeung committed Feb 9, 2025
1 parent a14e595 commit f1e4dd2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions apps/web/pages/api/auth/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type { NextApiRequest, NextApiResponse } from "next";
import { createMocks } from "node-mocks-http";
import { describe, test, expect, vi } from "vitest";

import { UserPermissionRole, CreationSource, IdentityProvider } from "@calcom/prisma/enums";

import handler from "./setup";

type CustomNextApiRequest = NextApiRequest & Request;
Expand Down Expand Up @@ -66,5 +68,23 @@ describe("setup", () => {
await handler(req, res);

expect(res.statusCode).toBe(200);

const user = await prismock.user.findFirst({
where: {
email: "[email protected]",
},
});

expect(user).toEqual(
expect.objectContaining({
email: "[email protected]",
username: "test",
locked: false,
organizationId: null,
identityProvider: IdentityProvider.CAL,
role: UserPermissionRole.ADMIN,
creationSource: CreationSource.SELF_SERVE_ADMIN,
})
);
});
});

0 comments on commit f1e4dd2

Please sign in to comment.