fix: uncaught types errors in invite members team handler (#16109)
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
"lint": "eslint . --ext .ts,.tsx",
|
||||
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
||||
"build": "yarn trpc:generate || true",
|
||||
"dev": "yarn build",
|
||||
"dx": "yarn build",
|
||||
"trpc:generate": "yarn tsc --project tsconfig.json"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
+7
-3
@@ -1,6 +1,8 @@
|
||||
import { beforeEach, vi, expect } from "vitest";
|
||||
import { mockReset, mockDeep } from "vitest-mock-extended";
|
||||
|
||||
import type { MembershipRole } from "@calcom/prisma/enums";
|
||||
|
||||
import type * as inviteMemberUtils from "../utils";
|
||||
|
||||
vi.mock("../utils", async () => {
|
||||
@@ -70,6 +72,7 @@ export const inviteMemberutilsScenarios = {
|
||||
team: any;
|
||||
invitations: {
|
||||
usernameOrEmail: string;
|
||||
newRole?: MembershipRole;
|
||||
}[];
|
||||
}
|
||||
) {
|
||||
@@ -77,9 +80,10 @@ export const inviteMemberutilsScenarios = {
|
||||
const allInvitationsExist = invitations.every((invitation) =>
|
||||
forInput.invitations.find((i) => i.usernameOrEmail === invitation.usernameOrEmail)
|
||||
);
|
||||
if (forInput.team.id == team.id && allInvitationsExist) return returnVal;
|
||||
if (forInput.team.id == team.id && allInvitationsExist) return Promise.resolve(returnVal);
|
||||
return Promise.resolve([]);
|
||||
});
|
||||
return returnVal;
|
||||
return Promise.resolve(returnVal);
|
||||
},
|
||||
},
|
||||
getOrgConnectionInfo: {
|
||||
@@ -102,7 +106,7 @@ export const expects = {
|
||||
teamId,
|
||||
}: {
|
||||
emails: string[];
|
||||
team;
|
||||
team: any[];
|
||||
inviterName: string;
|
||||
teamId: number;
|
||||
isOrg: boolean;
|
||||
|
||||
@@ -242,7 +242,7 @@ describe("inviteMemberHandler", () => {
|
||||
];
|
||||
|
||||
const retValueOfFindUsersWithInviteStatus =
|
||||
inviteMemberUtilsScenarios.findUsersWithInviteStatus.useAdvancedMock(
|
||||
await inviteMemberUtilsScenarios.findUsersWithInviteStatus.useAdvancedMock(
|
||||
[
|
||||
{
|
||||
...usersToBeInvited[0],
|
||||
|
||||
@@ -62,6 +62,7 @@ const mockedReturnSuccessCheckPerms = {
|
||||
isPrivate: false,
|
||||
logoUrl: "",
|
||||
calVideoLogo: "",
|
||||
isOrganization: false,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -69,7 +70,6 @@ const mockedRegularTeam: TeamWithParent = {
|
||||
id: 1,
|
||||
name: "Team A",
|
||||
slug: null,
|
||||
logo: null,
|
||||
appLogo: null,
|
||||
appIconLogo: null,
|
||||
bio: null,
|
||||
@@ -93,6 +93,7 @@ const mockedRegularTeam: TeamWithParent = {
|
||||
bannerUrl: "",
|
||||
isPlatform: false,
|
||||
smsLockState: "LOCKED",
|
||||
createdByOAuthClientId: null,
|
||||
};
|
||||
|
||||
const mockedSubTeam = {
|
||||
@@ -254,6 +255,11 @@ describe("Invite Member Utils", () => {
|
||||
isOrganizationConfigured: false,
|
||||
isOrganizationVerified: true,
|
||||
orgAutoAcceptEmail: "example.com",
|
||||
organizationId: 1,
|
||||
lockEventTypeCreationForUsers: false,
|
||||
adminGetsNoSlotsNotification: false,
|
||||
isAdminReviewed: false,
|
||||
isAdminAPIEnabled: false,
|
||||
},
|
||||
slug: "abc",
|
||||
parent: null,
|
||||
@@ -279,6 +285,11 @@ describe("Invite Member Utils", () => {
|
||||
isOrganizationConfigured: false,
|
||||
isOrganizationVerified: false,
|
||||
orgAutoAcceptEmail: "example.com",
|
||||
organizationId: 1,
|
||||
lockEventTypeCreationForUsers: false,
|
||||
adminGetsNoSlotsNotification: false,
|
||||
isAdminReviewed: false,
|
||||
isAdminAPIEnabled: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Team } from "@calcom/prisma/client";
|
||||
import type { Team } from "@prisma/client";
|
||||
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
|
||||
|
||||
import type { TInviteMemberInputSchema } from "./inviteMember.schema";
|
||||
|
||||
@@ -1,12 +1,40 @@
|
||||
{
|
||||
"extends": "@calcom/tsconfig/react-library.json",
|
||||
"include": ["client", "next", "react", "server"],
|
||||
"paths": {
|
||||
"~/*": ["/*"],
|
||||
"@calcom/app-store": ["../app-store"],
|
||||
"@calcom/app-store/*": ["../app-store/*"],
|
||||
"@calcom/dayjs": ["../dayjs"],
|
||||
"@calcom/dayjs/*": ["../dayjs/*"],
|
||||
"@calcom/features": ["../features"],
|
||||
"@calcom/features/*": ["../features/*"],
|
||||
"@calcom/lib": ["../lib"],
|
||||
"@calcom/lib/*": ["../lib/*"],
|
||||
"@calcom/platform-constants": ["../platform/constants/index.ts"],
|
||||
"@calcom/platform-types": ["../platform/types/index.ts"],
|
||||
"@calcom/platform-utils": ["../platform/utils/index.ts"],
|
||||
"@calcom/prisma": ["../prisma"],
|
||||
"@calcom/prisma/*": ["../prisma/*"]
|
||||
},
|
||||
"include": [
|
||||
"../types/@wojtekmaj__react-daterange-picker.d.ts",
|
||||
"../types/business-days-plugin.d.ts",
|
||||
"../types/next-auth.d.ts",
|
||||
"../types/next.d.ts",
|
||||
"../types/window.d.ts",
|
||||
"client",
|
||||
"next",
|
||||
"react",
|
||||
"server"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"isolatedModules": false,
|
||||
"noEmit": false,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"experimentalDecorators": true,
|
||||
"declarationMap": false,
|
||||
"resolveJsonModule": true,
|
||||
"outFile": "types/router.d.ts"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -128,11 +128,11 @@
|
||||
"outputs": ["dist/**", "build/**"]
|
||||
},
|
||||
"dev": {
|
||||
"dependsOn": ["//#env-check:common", "//#env-check:app-store"],
|
||||
"dependsOn": ["//#env-check:common", "//#env-check:app-store", "^dev"],
|
||||
"cache": false
|
||||
},
|
||||
"dx": {
|
||||
"dependsOn": ["//#env-check:common", "//#env-check:app-store"],
|
||||
"dependsOn": ["//#env-check:common", "//#env-check:app-store", "^dx"],
|
||||
"cache": false
|
||||
},
|
||||
"lint": {
|
||||
|
||||
Reference in New Issue
Block a user