fix: Error in team members migration during org onboarding (#15349)
* fix: Error in team members migration during org onboarding * Add invitationMemberHandler tests * Add unit tests * Improve tests and refactor * Improve tests and refactor * Fix type issue * Fix createNewUsersConnectToOrgIfExists args
This commit is contained in:
1 parent
750676f91a
commit
6670bbc1d7
15 files changed
+1212
-453
No files matched your search
@@ -5,7 +5,6 @@ import { createAProfileForAnExistingUser } from "@calcom/lib/createAProfileForAn
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { IdentityProvider, MembershipRole } from "@calcom/prisma/enums";
|
||||
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||
import {
|
||||
getTeamOrThrow,
|
||||
sendSignupToOrganizationEmail,
|
||||
@@ -115,7 +114,7 @@ const handleGroupEvents = async (event: DirectorySyncEvent, organizationId: numb
|
||||
newUserEmails.map((email) => {
|
||||
return sendSignupToOrganizationEmail({
|
||||
usernameOrEmail: email,
|
||||
team: { ...group.team, metadata: teamMetadataSchema.parse(group.team.metadata) },
|
||||
team: group.team,
|
||||
translation,
|
||||
inviterName: org.name,
|
||||
teamId: group.teamId,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { beforeEach, vi, expect } from "vitest";
|
||||
import { mockReset, mockDeep } from "vitest-mock-extended";
|
||||
|
||||
import type * as payments from "@calcom/features/ee/teams/lib/payments";
|
||||
|
||||
vi.mock("@calcom/features/ee/teams/lib/payments", () => paymentsMock);
|
||||
|
||||
beforeEach(() => {
|
||||
mockReset(paymentsMock);
|
||||
});
|
||||
|
||||
const paymentsMock = mockDeep<typeof payments>();
|
||||
|
||||
export const paymentsScenarios = {};
|
||||
export const paymentsExpects = {
|
||||
expectQuantitySubscriptionToBeUpdatedForTeam: (teamId: number) => {
|
||||
expect(paymentsMock.updateQuantitySubscriptionFromStripe).toHaveBeenCalledWith(teamId);
|
||||
},
|
||||
};
|
||||
|
||||
export default paymentsMock;
|
||||
Reference in new issue
Block a user