refactor: v2 api e2e performance (#19028)
* refactor: use unique names in e2e tests * refactor: version number in tests * refactor: use unique names in e2e tests * refactor: use unique names in e2e tests * refactor: test cleanup * refactor: increase e2e maxWorkers to 8 * refactor: randomNumber -> randomString * chore: add local e2e command
This commit is contained in:
1 parent
4fd5b3133d
commit
1043085741
49 files changed
+649
-559
No files matched your search
@@ -23,6 +23,7 @@ import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.
|
||||
import { TokensRepositoryFixture } from "test/fixtures/repository/tokens.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { MockedRedisService } from "test/mocks/mock-redis-service";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
|
||||
import { X_CAL_CLIENT_ID, X_CAL_SECRET_KEY } from "@calcom/platform-constants";
|
||||
|
||||
@@ -39,9 +40,9 @@ describe("ApiAuthStrategy", () => {
|
||||
let oAuthClientRepositoryFixture: OAuthClientRepositoryFixture;
|
||||
let profilesRepositoryFixture: ProfileRepositoryFixture;
|
||||
|
||||
const validApiKeyEmail = "[email protected]";
|
||||
const validAccessTokenEmail = "[email protected]";
|
||||
const validOAuthEmail = "[email protected]";
|
||||
const validApiKeyEmail = `api-auth-api-key-user-${randomString()}@api.com`;
|
||||
const validAccessTokenEmail = `api-auth-access-token-user-${randomString()}@api.com`;
|
||||
const validOAuthEmail = `api-auth-oauth-user-${randomString()}@api.com`;
|
||||
|
||||
let validApiKeyUser: User;
|
||||
let validAccessTokenUser: User;
|
||||
@@ -83,7 +84,7 @@ describe("ApiAuthStrategy", () => {
|
||||
teamRepositoryFixture = new TeamRepositoryFixture(module);
|
||||
oAuthClientRepositoryFixture = new OAuthClientRepositoryFixture(module);
|
||||
profilesRepositoryFixture = new ProfileRepositoryFixture(module);
|
||||
organization = await teamRepositoryFixture.create({ name: "organization" });
|
||||
organization = await teamRepositoryFixture.create({ name: `api-auth-organization-${randomString()}` });
|
||||
validApiKeyUser = await userRepositoryFixture.create({
|
||||
email: validApiKeyEmail,
|
||||
});
|
||||
|
||||
@@ -16,13 +16,14 @@ import { OAuthClientRepositoryFixture } from "test/fixtures/repository/oauth-cli
|
||||
import { OrganizationRepositoryFixture } from "test/fixtures/repository/organization.repository.fixture";
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { Team, PlatformOAuthClient, PlatformBilling } from "@calcom/prisma/client";
|
||||
|
||||
describe("Platform Billing Controller (e2e)", () => {
|
||||
let app: INestApplication;
|
||||
const userEmail = "platform-billing-controller-e2e@api.com";
|
||||
const userEmail = `billing-user-${randomString()}@api.com`;
|
||||
let user: UserWithProfile;
|
||||
let billing: PlatformBilling;
|
||||
let userRepositoryFixture: UserRepositoryFixture;
|
||||
@@ -47,7 +48,9 @@ describe("Platform Billing Controller (e2e)", () => {
|
||||
oauthClientRepositoryFixture = new OAuthClientRepositoryFixture(moduleRef);
|
||||
membershipsRepositoryFixture = new MembershipRepositoryFixture(moduleRef);
|
||||
platformBillingRepositoryFixture = new PlatformBillingRepositoryFixture(moduleRef);
|
||||
organization = await organizationsRepositoryFixture.create({ name: "platform billing" });
|
||||
organization = await organizationsRepositoryFixture.create({
|
||||
name: `billing-organization-${randomString()}`,
|
||||
});
|
||||
|
||||
user = await userRepositoryFixture.create({
|
||||
email: userEmail,
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ import { User } from "@prisma/client";
|
||||
import * as request from "supertest";
|
||||
import { CredentialsRepositoryFixture } from "test/fixtures/repository/credentials.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import {
|
||||
@@ -30,7 +31,7 @@ describe("Conferencing Endpoints", () => {
|
||||
let userRepositoryFixture: UserRepositoryFixture;
|
||||
let credentialsRepositoryFixture: CredentialsRepositoryFixture;
|
||||
|
||||
const userEmail = "conferencing-controller-user-e2e@api.com";
|
||||
const userEmail = `conferencing-user-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
||||
+8
-2
@@ -17,6 +17,7 @@ import { OAuthClientRepositoryFixture } from "test/fixtures/repository/oauth-cli
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { TokensRepositoryFixture } from "test/fixtures/repository/tokens.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
|
||||
import { APPLE_CALENDAR_TYPE, APPLE_CALENDAR_ID } from "@calcom/platform-constants";
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -55,9 +56,14 @@ describe("Platform Destination Calendar Endpoints", () => {
|
||||
teamRepositoryFixture = new TeamRepositoryFixture(moduleRef);
|
||||
tokensRepositoryFixture = new TokensRepositoryFixture(moduleRef);
|
||||
credentialsRepositoryFixture = new CredentialsRepositoryFixture(moduleRef);
|
||||
organization = await teamRepositoryFixture.create({ name: "organization" });
|
||||
organization = await teamRepositoryFixture.create({
|
||||
name: `destination-calendars-organization-${randomString()}`,
|
||||
});
|
||||
oAuthClient = await createOAuthClient(organization.id);
|
||||
user = await userRepositoryFixture.createOAuthManagedUser("[email protected]", oAuthClient.id);
|
||||
user = await userRepositoryFixture.createOAuthManagedUser(
|
||||
`destination-calendars-user-${randomString()}@api.com`,
|
||||
oAuthClient.id
|
||||
);
|
||||
const tokens = await tokensRepositoryFixture.createTokens(user.id, oAuthClient.id);
|
||||
accessTokenSecret = tokens.accessToken;
|
||||
refreshTokenSecret = tokens.refreshToken;
|
||||
|
||||
+7
-6
@@ -17,13 +17,14 @@ import * as request from "supertest";
|
||||
import { EventTypesRepositoryFixture } from "test/fixtures/repository/event-types.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { WebhookRepositoryFixture } from "test/fixtures/repository/webhooks.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { EventType, Webhook } from "@calcom/prisma/client";
|
||||
|
||||
describe("EventTypes WebhooksController (e2e)", () => {
|
||||
let app: INestApplication;
|
||||
const userEmail = "event-types-webhook-controller-e2e@api.com";
|
||||
const userEmail = `event-types-webhooks-user-${randomString()}@api.com`;
|
||||
let user: UserWithProfile;
|
||||
let otherUser: UserWithProfile;
|
||||
let eventType: EventType;
|
||||
@@ -55,14 +56,14 @@ describe("EventTypes WebhooksController (e2e)", () => {
|
||||
});
|
||||
|
||||
otherUser = await userRepositoryFixture.create({
|
||||
email: "other-user-webhook-controller@api.com",
|
||||
username: "other-user-webhook-controller@api.com",
|
||||
email: `event-types-webhooks-other-user-${randomString()}@api.com`,
|
||||
username: `event-types-webhooks-other-user-${randomString()}@api.com`,
|
||||
});
|
||||
|
||||
eventType = await eventTypeRepositoryFixture.create(
|
||||
{
|
||||
title: "Event Type 1",
|
||||
slug: "webhook-event-type-1",
|
||||
slug: `event-types-webhooks-event-type-${randomString()}`,
|
||||
length: 60,
|
||||
},
|
||||
user.id
|
||||
@@ -71,7 +72,7 @@ describe("EventTypes WebhooksController (e2e)", () => {
|
||||
eventType2 = await eventTypeRepositoryFixture.create(
|
||||
{
|
||||
title: "Event Type 2",
|
||||
slug: "webhook-event-type-2",
|
||||
slug: `event-types-webhooks-event-type-${randomString()}`,
|
||||
length: 60,
|
||||
},
|
||||
user.id
|
||||
@@ -80,7 +81,7 @@ describe("EventTypes WebhooksController (e2e)", () => {
|
||||
otherEventType = await eventTypeRepositoryFixture.create(
|
||||
{
|
||||
title: "Other Event Type ",
|
||||
slug: "other-webhook-event-type",
|
||||
slug: `event-types-webhooks-other-event-type-${randomString()}`,
|
||||
length: 60,
|
||||
},
|
||||
otherUser.id
|
||||
|
||||
+10
-9
@@ -22,6 +22,7 @@ import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repo
|
||||
import { SchedulesRepositoryFixture } from "test/fixtures/repository/schedules.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
import { ApiSuccessResponse } from "@calcom/platform-types";
|
||||
@@ -84,10 +85,10 @@ describe("OAuth Client Users Endpoints", () => {
|
||||
|
||||
let postResponseData: CreateManagedUserOutput["data"];
|
||||
|
||||
const platformAdminEmail = "[email protected]";
|
||||
const platformAdminEmail = `oauth-client-users-admin-${randomString()}@api.com`;
|
||||
let platformAdmin: User;
|
||||
|
||||
const userEmail = "[email protected]";
|
||||
const userEmail = `oauth-client-users-user-${randomString()}@api.com`;
|
||||
const userTimeZone = "Europe/Rome";
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -110,7 +111,7 @@ describe("OAuth Client Users Endpoints", () => {
|
||||
platformAdmin = await userRepositoryFixture.create({ email: platformAdminEmail });
|
||||
|
||||
organization = await teamRepositoryFixture.create({
|
||||
name: "organization",
|
||||
name: `oauth-client-users-organization-${randomString()}`,
|
||||
isPlatform: true,
|
||||
isOrganization: true,
|
||||
});
|
||||
@@ -392,7 +393,7 @@ describe("OAuth Client Users Endpoints", () => {
|
||||
let membershipsRepositoryFixture: MembershipRepositoryFixture;
|
||||
let postResponseData: CreateManagedUserOutput["data"];
|
||||
|
||||
const userEmail = "[email protected]";
|
||||
const userEmail = `oauth-client-users-user-${randomString()}@api.com`;
|
||||
const userTimeZone = "Europe/Rome";
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -411,20 +412,20 @@ describe("OAuth Client Users Endpoints", () => {
|
||||
profileRepositoryFixture = new ProfileRepositoryFixture(moduleRef);
|
||||
membershipsRepositoryFixture = new MembershipRepositoryFixture(moduleRef);
|
||||
organization = await teamRepositoryFixture.create({
|
||||
name: "Testy Organization",
|
||||
isOrganization: true,
|
||||
name: `oauth-client-users-organization-${randomString()}`,
|
||||
isPlatform: true,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
owner = await userRepositoryFixture.create({
|
||||
email: userEmail,
|
||||
username: userEmail,
|
||||
email: `oauth-client-users-admin-${randomString()}@api.com`,
|
||||
username: `oauth-client-users-admin-${randomString()}@api.com`,
|
||||
organization: { connect: { id: organization.id } },
|
||||
});
|
||||
|
||||
await profileRepositoryFixture.create({
|
||||
uid: `usr-${owner.id}`,
|
||||
username: userEmail,
|
||||
username: `oauth-client-users-admin-${randomString()}@api.com`,
|
||||
organization: {
|
||||
connect: {
|
||||
id: organization.id,
|
||||
|
||||
+5
-4
@@ -20,14 +20,15 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { WebhookRepositoryFixture } from "test/fixtures/repository/webhooks.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withNextAuth } from "test/utils/withNextAuth";
|
||||
|
||||
import { PlatformOAuthClient, Team, Webhook } from "@calcom/prisma/client";
|
||||
|
||||
describe("OAuth client WebhooksController (e2e)", () => {
|
||||
let app: INestApplication;
|
||||
const userEmail = "oauth-client-webhook-controller-e2e@api.com";
|
||||
const otherUserEmail = "other-oauth-client-webhook-controller-e2e@api.com";
|
||||
const userEmail = `oauth-client-webhooks-user-${randomString()}@api.com`;
|
||||
const otherUserEmail = `oauth-client-webhooks-other-user-${randomString()}@api.com`;
|
||||
let user: UserWithProfile;
|
||||
let otherUser: UserWithProfile;
|
||||
let oAuthClient: PlatformOAuthClient;
|
||||
@@ -69,7 +70,7 @@ describe("OAuth client WebhooksController (e2e)", () => {
|
||||
});
|
||||
|
||||
org = await orgRepositoryFixture.create({
|
||||
name: "apiOrg",
|
||||
name: `oauth-client-webhooks-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
metadata: {
|
||||
isOrganization: true,
|
||||
@@ -80,7 +81,7 @@ describe("OAuth client WebhooksController (e2e)", () => {
|
||||
isPlatform: true,
|
||||
});
|
||||
otherOrg = await orgRepositoryFixture.create({
|
||||
name: "otherOrg",
|
||||
name: `oauth-client-webhooks-other-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
metadata: {
|
||||
isOrganization: true,
|
||||
|
||||
+9
-8
@@ -18,6 +18,7 @@ import { MembershipRepositoryFixture } from "test/fixtures/repository/membership
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { NextAuthMockStrategy } from "test/mocks/next-auth-mock.strategy";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withNextAuth } from "test/utils/withNextAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -68,7 +69,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let app: INestApplication;
|
||||
const userEmail = "oauth-clients-test-e2e@api.com";
|
||||
const userEmail = `oauth-clients-user-${randomString()}@api.com`;
|
||||
|
||||
beforeAll(async () => {
|
||||
const moduleRef = await withNextAuth(
|
||||
@@ -89,7 +90,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
email: userEmail,
|
||||
});
|
||||
org = await teamFixtures.create({
|
||||
name: "apiOrg",
|
||||
name: `oauth-clients-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
metadata: {
|
||||
isOrganization: true,
|
||||
@@ -126,7 +127,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let app: INestApplication;
|
||||
const userEmail = "test-e2e@api.com";
|
||||
const userEmail = `oauth-clients-user-${randomString()}@api.com`;
|
||||
|
||||
beforeAll(async () => {
|
||||
const moduleRef = await withNextAuth(
|
||||
@@ -147,7 +148,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
email: userEmail,
|
||||
});
|
||||
org = await teamFixtures.create({
|
||||
name: "apiOrg",
|
||||
name: `oauth-clients-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
metadata: {
|
||||
isOrganization: true,
|
||||
@@ -211,7 +212,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
describe("User is part of an organization as Admin", () => {
|
||||
let membership: Membership;
|
||||
let client: { clientId: string; clientSecret: string };
|
||||
const oAuthClientName = "test-oauth-client-admin";
|
||||
const oAuthClientName = `oauth-clients-admin-${randomString()}`;
|
||||
|
||||
beforeAll(async () => {
|
||||
membership = await membershipFixtures.addUserToOrg(user, org, "ADMIN", true);
|
||||
@@ -264,7 +265,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
});
|
||||
});
|
||||
it(`/PUT/:id`, () => {
|
||||
const clientUpdatedName = "test-oauth-client-updated";
|
||||
const clientUpdatedName = `oauth-clients-admin-updated-${randomString()}`;
|
||||
const body: UpdateOAuthClientInput = { name: clientUpdatedName };
|
||||
return request(app.getHttpServer())
|
||||
.patch(`/api/v2/oauth-clients/${client.clientId}`)
|
||||
@@ -289,7 +290,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
describe("User is part of an organization as Owner", () => {
|
||||
let membership: Membership;
|
||||
let client: { clientId: string; clientSecret: string };
|
||||
const oAuthClientName = "test-oauth-client-owner";
|
||||
const oAuthClientName = `oauth-clients-owner-${randomString()}`;
|
||||
const oAuthClientPermissions = 32;
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -346,7 +347,7 @@ describe("OAuth Clients Endpoints", () => {
|
||||
});
|
||||
});
|
||||
it(`/PUT/:id`, () => {
|
||||
const clientUpdatedName = "test-oauth-client-updated";
|
||||
const clientUpdatedName = `oauth-clients-owner-updated-${randomString()}`;
|
||||
const body: UpdateOAuthClientInput = { name: clientUpdatedName };
|
||||
return request(app.getHttpServer())
|
||||
.patch(`/api/v2/oauth-clients/${client.clientId}`)
|
||||
|
||||
+5
-2
@@ -19,6 +19,7 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withNextAuth } from "test/utils/withNextAuth";
|
||||
|
||||
import { X_CAL_SECRET_KEY } from "@calcom/platform-constants";
|
||||
@@ -70,7 +71,7 @@ describe("OAuthFlow Endpoints", () => {
|
||||
let refreshToken: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
const userEmail = "[email protected]";
|
||||
const userEmail = `oauth-flow-user-${randomString()}@api.com`;
|
||||
|
||||
const moduleRef: TestingModule = await withNextAuth(
|
||||
userEmail,
|
||||
@@ -92,7 +93,9 @@ describe("OAuthFlow Endpoints", () => {
|
||||
email: userEmail,
|
||||
});
|
||||
|
||||
organization = await organizationsRepositoryFixture.create({ name: "organization" });
|
||||
organization = await organizationsRepositoryFixture.create({
|
||||
name: `oauth-flow-organization-${randomString()}`,
|
||||
});
|
||||
await profilesRepositoryFixture.create({
|
||||
uid: "asd-asd",
|
||||
username: userEmail,
|
||||
|
||||
+5
-4
@@ -14,6 +14,7 @@ import { AttributeRepositoryFixture } from "test/fixtures/repository/attributes.
|
||||
import { MembershipRepositoryFixture } from "test/fixtures/repository/membership.repository.fixture";
|
||||
import { OrganizationRepositoryFixture } from "test/fixtures/repository/organization.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -26,7 +27,7 @@ describe("Organizations Attributes Options Endpoints", () => {
|
||||
let organizationsRepositoryFixture: OrganizationRepositoryFixture;
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
|
||||
const userEmail = "member@attributes-options-api.com";
|
||||
const userEmail = `organization-attributes-options-member-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let membership: Membership;
|
||||
@@ -45,7 +46,7 @@ describe("Organizations Attributes Options Endpoints", () => {
|
||||
membershipFixtures = new MembershipRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "AttributesOptionsCorp",
|
||||
name: `organization-attributes-options-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -97,7 +98,7 @@ describe("Organizations Attributes Options Endpoints", () => {
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
let attributeRepositoryFixture: AttributeRepositoryFixture;
|
||||
|
||||
const userEmail = "admin@attributes-options-api.com";
|
||||
const userEmail = `organization-attributes-options-admin-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let membership: Membership;
|
||||
@@ -123,7 +124,7 @@ describe("Organizations Attributes Options Endpoints", () => {
|
||||
attributeRepositoryFixture = new AttributeRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "AttributesOptionsCorp",
|
||||
name: `organization-attributes-options-admin-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
|
||||
+5
-4
@@ -12,6 +12,7 @@ import * as request from "supertest";
|
||||
import { MembershipRepositoryFixture } from "test/fixtures/repository/membership.repository.fixture";
|
||||
import { OrganizationRepositoryFixture } from "test/fixtures/repository/organization.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -24,7 +25,7 @@ describe("Organizations Attributes Endpoints", () => {
|
||||
let organizationsRepositoryFixture: OrganizationRepositoryFixture;
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
|
||||
const userEmail = "member@attributes-api.com";
|
||||
const userEmail = `organization-attributes-member-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let membership: Membership;
|
||||
@@ -42,7 +43,7 @@ describe("Organizations Attributes Endpoints", () => {
|
||||
membershipFixtures = new MembershipRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "AttributesCorp",
|
||||
name: `organization-attributes-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -88,7 +89,7 @@ describe("Organizations Attributes Endpoints", () => {
|
||||
let organizationsRepositoryFixture: OrganizationRepositoryFixture;
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
|
||||
const userEmail = "admin@attributes-api.com";
|
||||
const userEmail = `organization-attributes-admin-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let membership: Membership;
|
||||
@@ -116,7 +117,7 @@ describe("Organizations Attributes Endpoints", () => {
|
||||
membershipFixtures = new MembershipRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "AttributesCorp",
|
||||
name: `organization-attributes-admin-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
|
||||
+12
-11
@@ -14,6 +14,7 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -48,12 +49,12 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
let falseTestOrg: Team;
|
||||
let falseTestTeam: Team;
|
||||
|
||||
const userEmail = "org-admin-event-types-controller-e222e@api.com";
|
||||
const userEmail = `organizations-event-types-admin-${randomString()}@api.com`;
|
||||
let userAdmin: User;
|
||||
|
||||
const teammate1Email = "[email protected]";
|
||||
const teammate2Email = "[email protected]";
|
||||
const falseTestUserEmail = "[email protected]";
|
||||
const teammate1Email = `organizations-event-types-teammate1-${randomString()}@api.com`;
|
||||
const teammate2Email = `organizations-event-types-teammate2-${randomString()}@api.com`;
|
||||
const falseTestUserEmail = `organizations-event-types-false-user-${randomString()}@api.com`;
|
||||
let teammate1: User;
|
||||
let teammate2: User;
|
||||
let falseTestUser: User;
|
||||
@@ -98,23 +99,23 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-event-types-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
falseTestOrg = await organizationsRepositoryFixture.create({
|
||||
name: "False test org",
|
||||
name: `organizations-event-types-false-org-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
team = await teamsRepositoryFixture.create({
|
||||
name: "Test org team",
|
||||
name: `organizations-event-types-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
|
||||
falseTestTeam = await teamsRepositoryFixture.create({
|
||||
name: "Outside org team",
|
||||
name: `organizations-event-types-false-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: falseTestOrg.id } },
|
||||
});
|
||||
@@ -237,7 +238,7 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
const body: CreateTeamEventTypeInput_2024_06_14 = {
|
||||
successRedirectUrl: "https://masterchief.com/argentina/flan/video/1234",
|
||||
title: "Coding consultation collective",
|
||||
slug: "coding-consultation collective",
|
||||
slug: `organizations-event-types-collective-${randomString()}`,
|
||||
description: "Our team will review your codebase.",
|
||||
lengthInMinutes: 60,
|
||||
locations: [
|
||||
@@ -343,7 +344,7 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
it("should create a managed team event-type", async () => {
|
||||
const body: CreateTeamEventTypeInput_2024_06_14 = {
|
||||
title: "Coding consultation managed",
|
||||
slug: "coding-consultation-managed",
|
||||
slug: `organizations-event-types-managed-${randomString()}`,
|
||||
description: "Our team will review your codebase.",
|
||||
lengthInMinutes: 60,
|
||||
locations: [
|
||||
@@ -751,10 +752,10 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
it("should return event type with default bookingFields if they are not defined", async () => {
|
||||
const eventTypeInput = {
|
||||
title: "unknown field event type two",
|
||||
slug: `organizations-event-types-unknown-${randomString()}`,
|
||||
description: "unknown field event type description two",
|
||||
length: 40,
|
||||
hidden: false,
|
||||
slug: "unknown-field-type-two",
|
||||
locations: [],
|
||||
schedulingType: SchedulingType.ROUND_ROBIN,
|
||||
};
|
||||
|
||||
+7
-7
@@ -14,6 +14,7 @@ import { MembershipRepositoryFixture } from "test/fixtures/repository/membership
|
||||
import { OrganizationRepositoryFixture } from "test/fixtures/repository/organization.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -33,10 +34,9 @@ describe("Organizations Memberships Endpoints", () => {
|
||||
let membership2: Membership;
|
||||
let membershipCreatedViaApi: Membership;
|
||||
|
||||
const userEmail = "org-admin-membership-controller-e2e@api.com";
|
||||
const userEmail2 = "org-member-membership-controller-e2e@api.com";
|
||||
|
||||
const invitedUserEmail = "[email protected]";
|
||||
const userEmail = `organizations-memberships-admin-${randomString()}@api.com`;
|
||||
const userEmail2 = `organizations-memberships-member-${randomString()}@api.com`;
|
||||
const invitedUserEmail = `organizations-memberships-invited-${randomString()}@api.com`;
|
||||
|
||||
let user: User;
|
||||
let user2: User;
|
||||
@@ -70,7 +70,7 @@ describe("Organizations Memberships Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-memberships-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -217,7 +217,7 @@ describe("Organizations Memberships Endpoints", () => {
|
||||
let org: Team;
|
||||
let membership: Membership;
|
||||
|
||||
const userEmail = "org-member-memberships-controller-e2e@api.com";
|
||||
const userEmail = `organizations-memberships-member-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -238,7 +238,7 @@ describe("Organizations Memberships Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-memberships-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
|
||||
+11
-7
@@ -12,6 +12,7 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -35,7 +36,7 @@ describe("Organizations Schedules Endpoints", () => {
|
||||
let organizationsRepositoryFixture: OrganizationRepositoryFixture;
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
|
||||
const userEmail = "mr-robot@schedules-api.com";
|
||||
const userEmail = `organizations-schedules-member-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let membership: Membership;
|
||||
@@ -53,7 +54,7 @@ describe("Organizations Schedules Endpoints", () => {
|
||||
membershipFixtures = new MembershipRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Ecorp",
|
||||
name: `organizations-schedules-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -115,12 +116,15 @@ describe("Organizations Schedules Endpoints", () => {
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
let profileRepositoryFixture: ProfileRepositoryFixture;
|
||||
|
||||
const userEmail = "mr-robot@schedules-api.com";
|
||||
const username = "mr-robot";
|
||||
const userEmail = `organizations-schedules-admin-${randomString()}@api.com`;
|
||||
const userEmail2 = `organizations-schedules-member-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let user2: User;
|
||||
let org: Team;
|
||||
let profile: Profile;
|
||||
let membership: Membership;
|
||||
let membership2: Membership;
|
||||
let profile: Profile;
|
||||
let profile2: Profile;
|
||||
|
||||
let createdSchedule: ScheduleOutput_2024_06_11;
|
||||
|
||||
@@ -152,7 +156,7 @@ describe("Organizations Schedules Endpoints", () => {
|
||||
profileRepositoryFixture = new ProfileRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Ecorp",
|
||||
name: `organizations-schedules-admin-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -164,7 +168,7 @@ describe("Organizations Schedules Endpoints", () => {
|
||||
|
||||
profile = await profileRepositoryFixture.create({
|
||||
uid: `usr-${user.id}`,
|
||||
username: username,
|
||||
username: userEmail,
|
||||
organization: {
|
||||
connect: {
|
||||
id: org.id,
|
||||
|
||||
+8
-8
@@ -17,6 +17,7 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -44,11 +45,10 @@ describe("Organizations Teams Memberships Endpoints", () => {
|
||||
let membership2: Membership;
|
||||
let membershipCreatedViaApi: OrgTeamMembershipOutputDto;
|
||||
|
||||
const userEmail = "org-admin-membership-teams-controller-e2e@api.com";
|
||||
const userEmail2 = "org-member-membership-teams-controller-e2e@api.com";
|
||||
const nonOrgUserEmail = "non-org-member-membership-teams-controller-e2e@api.com";
|
||||
|
||||
const invitedUserEmail = "[email protected]";
|
||||
const userEmail = `organizations-teams-memberships-admin-${randomString()}@api.com`;
|
||||
const userEmail2 = `organizations-teams-memberships-member-${randomString()}@api.com`;
|
||||
const nonOrgUserEmail = `organizations-teams-memberships-non-org-${randomString()}@api.com`;
|
||||
const invitedUserEmail = `organizations-teams-memberships-invited-${randomString()}@api.com`;
|
||||
|
||||
let user: User;
|
||||
let user2: User;
|
||||
@@ -92,12 +92,12 @@ describe("Organizations Teams Memberships Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-teams-memberships-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
orgTeam = await teamsRepositoryFixture.create({
|
||||
name: "Org Team",
|
||||
name: `organizations-teams-memberships-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
@@ -129,7 +129,7 @@ describe("Organizations Teams Memberships Endpoints", () => {
|
||||
});
|
||||
|
||||
nonOrgTeam = await teamsRepositoryFixture.create({
|
||||
name: "Non Org Team",
|
||||
name: `organizations-teams-memberships-non-org-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
});
|
||||
|
||||
|
||||
+30
-26
@@ -15,6 +15,7 @@ import { OAuthClientRepositoryFixture } from "test/fixtures/repository/oauth-cli
|
||||
import { OrganizationRepositoryFixture } from "test/fixtures/repository/organization.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS, X_CAL_CLIENT_ID, X_CAL_SECRET_KEY } from "@calcom/platform-constants";
|
||||
@@ -36,7 +37,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
let teamCreatedViaApi: Team;
|
||||
let teamCreatedViaApi2: Team;
|
||||
|
||||
const userEmail = "org-admin-teams-controller-e2e@api.com";
|
||||
const userEmail = `organizations-teams-admin-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -58,7 +59,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-teams-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -69,13 +70,13 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
team = await teamsRepositoryFixture.create({
|
||||
name: "Test org team",
|
||||
name: `organizations-teams-team1-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
|
||||
team2 = await teamsRepositoryFixture.create({
|
||||
name: "Test org team 2",
|
||||
name: `organizations-teams-team2-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
@@ -133,10 +134,11 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
it("should create the team of the org", async () => {
|
||||
const teamName = `organizations-teams-api-team1-${randomString()}`;
|
||||
return request(app.getHttpServer())
|
||||
.post(`/v2/organizations/${org.id}/teams`)
|
||||
.send({
|
||||
name: "Team created via API",
|
||||
name: teamName,
|
||||
slug: "team-created-via-api",
|
||||
bio: "This is our test team created via API",
|
||||
} satisfies CreateOrgTeamDto)
|
||||
@@ -145,7 +147,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
const responseBody: ApiSuccessResponse<Team> = response.body;
|
||||
expect(responseBody.status).toEqual(SUCCESS_STATUS);
|
||||
teamCreatedViaApi = responseBody.data;
|
||||
expect(teamCreatedViaApi.name).toEqual("Team created via API");
|
||||
expect(teamCreatedViaApi.name).toEqual(teamName);
|
||||
expect(teamCreatedViaApi.slug).toEqual("team-created-via-api");
|
||||
expect(teamCreatedViaApi.bio).toEqual("This is our test team created via API");
|
||||
expect(teamCreatedViaApi.parentId).toEqual(org.id);
|
||||
@@ -171,10 +173,11 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
it("should update the team of the org", async () => {
|
||||
const updatedTeamName = `organizations-teams-api-team1-${randomString()}-updated`;
|
||||
return request(app.getHttpServer())
|
||||
.patch(`/v2/organizations/${org.id}/teams/${teamCreatedViaApi.id}`)
|
||||
.send({
|
||||
name: "Team created via API Updated",
|
||||
name: updatedTeamName,
|
||||
weekStart: "Monday",
|
||||
logoUrl: "https://i.cal.com/api/avatar/b0b58752-68ad-4c0d-8024-4fa382a77752.png",
|
||||
bannerUrl: "https://i.cal.com/api/avatar/949be534-7a88-4185-967c-c020b0c0bef3.png",
|
||||
@@ -184,7 +187,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
const responseBody: ApiSuccessResponse<Team> = response.body;
|
||||
expect(responseBody.status).toEqual(SUCCESS_STATUS);
|
||||
teamCreatedViaApi = responseBody.data;
|
||||
expect(teamCreatedViaApi.name).toEqual("Team created via API Updated");
|
||||
expect(teamCreatedViaApi.name).toEqual(updatedTeamName);
|
||||
expect(teamCreatedViaApi.weekStart).toEqual("Monday");
|
||||
expect(teamCreatedViaApi.logoUrl).toEqual(
|
||||
"https://i.cal.com/api/avatar/b0b58752-68ad-4c0d-8024-4fa382a77752.png"
|
||||
@@ -219,10 +222,11 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
it("should create the team of the org without auto-accepting creator", async () => {
|
||||
const teamName = `organizations-teams-api-team2-${randomString()}`;
|
||||
return request(app.getHttpServer())
|
||||
.post(`/v2/organizations/${org.id}/teams`)
|
||||
.send({
|
||||
name: "Team II created via API",
|
||||
name: teamName,
|
||||
autoAcceptCreator: false,
|
||||
} satisfies CreateOrgTeamDto)
|
||||
.expect(201)
|
||||
@@ -230,7 +234,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
const responseBody: ApiSuccessResponse<Team> = response.body;
|
||||
expect(responseBody.status).toEqual(SUCCESS_STATUS);
|
||||
teamCreatedViaApi2 = responseBody.data;
|
||||
expect(teamCreatedViaApi2.name).toEqual("Team II created via API");
|
||||
expect(teamCreatedViaApi2.name).toEqual(teamName);
|
||||
expect(teamCreatedViaApi2.parentId).toEqual(org.id);
|
||||
const membership = await membershipsRepositoryFixture.getUserMembershipByTeamId(
|
||||
user.id,
|
||||
@@ -265,7 +269,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
let team: Team;
|
||||
let team2: Team;
|
||||
|
||||
const userEmail = "org-member-teams-controller-e2e@api.com";
|
||||
const userEmail = `organizations-teams-member-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -287,7 +291,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-teams-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -298,13 +302,13 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
team = await teamsRepositoryFixture.create({
|
||||
name: "Test org team",
|
||||
name: `organizations-teams-team1-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
|
||||
team2 = await teamsRepositoryFixture.create({
|
||||
name: "Test org team 2",
|
||||
name: `organizations-teams-team2-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
@@ -338,7 +342,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/v2/organizations/${org.id}/teams`)
|
||||
.send({
|
||||
name: "Team created via API",
|
||||
name: `organizations-teams-api-team1-${randomString()}`,
|
||||
} satisfies CreateOrgTeamDto)
|
||||
.expect(403);
|
||||
});
|
||||
@@ -347,7 +351,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
return request(app.getHttpServer())
|
||||
.patch(`/v2/organizations/${org.id}/teams/${team.id}`)
|
||||
.send({
|
||||
name: "Team created via API Updated",
|
||||
name: `organizations-teams-api-team1-${randomString()}-updated`,
|
||||
} satisfies CreateOrgTeamDto)
|
||||
.expect(403);
|
||||
});
|
||||
@@ -379,7 +383,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
let team: Team;
|
||||
let team2: Team;
|
||||
|
||||
const userEmail = "org-member-teams-owner-controller-e2e@api.com";
|
||||
const userEmail = `organizations-teams-owner-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -401,7 +405,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-teams-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -412,13 +416,13 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
team = await teamsRepositoryFixture.create({
|
||||
name: "Test org team",
|
||||
name: `organizations-teams-team1-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
|
||||
team2 = await teamsRepositoryFixture.create({
|
||||
name: "Test org team 2",
|
||||
name: `organizations-teams-team2-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
@@ -464,7 +468,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/v2/organizations/${org.id}/teams`)
|
||||
.send({
|
||||
name: "Team created via API",
|
||||
name: `organizations-teams-api-team1-${randomString()}`,
|
||||
} satisfies CreateOrgTeamDto)
|
||||
.expect(403);
|
||||
});
|
||||
@@ -473,7 +477,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
return request(app.getHttpServer())
|
||||
.patch(`/v2/organizations/${org.id}/teams/${team.id}`)
|
||||
.send({
|
||||
name: "Team created via API Updated",
|
||||
name: `organizations-teams-api-team1-${randomString()}-updated`,
|
||||
} satisfies CreateOrgTeamDto)
|
||||
.expect(403);
|
||||
});
|
||||
@@ -509,7 +513,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
let team1: Team;
|
||||
let team2: Team;
|
||||
|
||||
const userEmail = "platform-org-member-teams-owner-controller-e2e@api.com";
|
||||
const userEmail = `organizations-teams-platform-owner-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -531,7 +535,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await orgRepositoryFixture.create({
|
||||
name: "Platform Test Organization",
|
||||
name: `organizations-teams-platform-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -570,7 +574,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
it("should create first oAuth client team", async () => {
|
||||
const teamName = "Platform team created via API";
|
||||
const teamName = `organizations-teams-platform-api-team1-${randomString()}`;
|
||||
return request(app.getHttpServer())
|
||||
.post(`/v2/organizations/${org.id}/teams`)
|
||||
.set(X_CAL_CLIENT_ID, oAuthClient1.id)
|
||||
@@ -593,7 +597,7 @@ describe("Organizations Team Endpoints", () => {
|
||||
});
|
||||
|
||||
it("should create second oAuth client team", async () => {
|
||||
const teamName = "Platform team II created via API";
|
||||
const teamName = `organizations-teams-platform-api-team2-${randomString()}`;
|
||||
return request(app.getHttpServer())
|
||||
.post(`/v2/organizations/${org.id}/teams`)
|
||||
.set(X_CAL_CLIENT_ID, oAuthClient2.id)
|
||||
|
||||
+9
-9
@@ -14,6 +14,7 @@ import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repo
|
||||
import { SchedulesRepositoryFixture } from "test/fixtures/repository/schedules.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -37,11 +38,10 @@ describe("Organizations Teams Schedules Endpoints", () => {
|
||||
let nonOrgTeam: Team;
|
||||
let user2Schedule: Schedule;
|
||||
|
||||
const userEmail = "org-admin-schedules-teams-controller-e2e@api.com";
|
||||
const userEmail2 = "org-member-schedules-teams-controller-e2e@api.com";
|
||||
const nonOrgUserEmail = "non-org-member-schedules-teams-controller-e2e@api.com";
|
||||
|
||||
const invitedUserEmail = "[email protected]";
|
||||
const userEmail = `organizations-teams-schedules-admin-${randomString()}@api.com`;
|
||||
const userEmail2 = `organizations-teams-schedules-member-${randomString()}@api.com`;
|
||||
const nonOrgUserEmail = `organizations-teams-schedules-non-org-${randomString()}@api.com`;
|
||||
const invitedUserEmail = `organizations-teams-schedules-invited-${randomString()}@api.com`;
|
||||
|
||||
let user: User;
|
||||
let user2: User;
|
||||
@@ -79,7 +79,7 @@ describe("Organizations Teams Schedules Endpoints", () => {
|
||||
id: user2.id,
|
||||
},
|
||||
},
|
||||
name: "User 2 schedule",
|
||||
name: `organizations-teams-schedules-user2-schedule-${randomString()}`,
|
||||
timeZone: "America/New_York",
|
||||
});
|
||||
|
||||
@@ -94,18 +94,18 @@ describe("Organizations Teams Schedules Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-teams-schedules-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
orgTeam = await teamsRepositoryFixture.create({
|
||||
name: "Org Team",
|
||||
name: `organizations-teams-schedules-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
|
||||
nonOrgTeam = await teamsRepositoryFixture.create({
|
||||
name: "Non Org Team",
|
||||
name: `organizations-teams-schedules-non-org-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
});
|
||||
|
||||
|
||||
+9
-8
@@ -14,6 +14,7 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -34,12 +35,12 @@ describe("Organizations User OOO Endpoints", () => {
|
||||
let falseTestOrg: Team;
|
||||
let falseTestTeam: Team;
|
||||
|
||||
const userEmail = "org-admin-ooo-controller-e222e@api.com";
|
||||
const userEmail = `organizations-users-ooo-admin-${randomString()}@api.com`;
|
||||
let userAdmin: User;
|
||||
|
||||
const teammate1Email = "[email protected]";
|
||||
const teammate2Email = "[email protected]";
|
||||
const falseTestUserEmail = "[email protected]";
|
||||
const teammate1Email = `organizations-users-ooo-member1-${randomString()}@api.com`;
|
||||
const teammate2Email = `organizations-users-ooo-member2-${randomString()}@api.com`;
|
||||
const falseTestUserEmail = `organizations-users-ooo-false-user-${randomString()}@api.com`;
|
||||
let teammate1: User;
|
||||
let teammate2: User;
|
||||
let falseTestUser: User;
|
||||
@@ -80,23 +81,23 @@ describe("Organizations User OOO Endpoints", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization ooo",
|
||||
name: `organizations-users-ooo-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
falseTestOrg = await organizationsRepositoryFixture.create({
|
||||
name: "False test org ooo",
|
||||
name: `organizations-users-ooo-false-org-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
team = await teamsRepositoryFixture.create({
|
||||
name: "Test org team ooo",
|
||||
name: `organizations-users-ooo-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
|
||||
falseTestTeam = await teamsRepositoryFixture.create({
|
||||
name: "Outside org team ooo",
|
||||
name: `organizations-users-ooo-false-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: falseTestOrg.id } },
|
||||
});
|
||||
|
||||
+21
-20
@@ -15,6 +15,7 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -29,7 +30,7 @@ describe("Organizations Users Endpoints", () => {
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
let profileRepositoryFixture: ProfileRepositoryFixture;
|
||||
|
||||
const userEmail = "[email protected]";
|
||||
const userEmail = `organizations-users-member-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let org: Team;
|
||||
|
||||
@@ -47,7 +48,7 @@ describe("Organizations Users Endpoints", () => {
|
||||
profileRepositoryFixture = new ProfileRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test org 3",
|
||||
name: `organizations-users-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -118,24 +119,24 @@ describe("Organizations Users Endpoints", () => {
|
||||
let organizationsRepositoryFixture: OrganizationRepositoryFixture;
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
|
||||
const userEmail = "[email protected]";
|
||||
const nonMemberEmail = "[email protected]";
|
||||
const userEmail = `organizations-users-admin-${randomString()}@api.com`;
|
||||
const nonMemberEmail = `organizations-users-non-member-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let createdUser: User;
|
||||
|
||||
const orgMembersData = [
|
||||
{
|
||||
email: "[email protected]",
|
||||
username: "[email protected]",
|
||||
email: `organizations-users-member1-${randomString()}@api.com`,
|
||||
username: `organizations-users-member1-${randomString()}@api.com`,
|
||||
},
|
||||
{
|
||||
email: "[email protected]",
|
||||
username: "[email protected]",
|
||||
email: `organizations-users-member2-${randomString()}@api.com`,
|
||||
username: `organizations-users-member2-${randomString()}@api.com`,
|
||||
},
|
||||
{
|
||||
email: "[email protected]",
|
||||
username: "[email protected]",
|
||||
email: `organizations-users-member3-${randomString()}@api.com`,
|
||||
username: `organizations-users-member3-${randomString()}@api.com`,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -154,7 +155,7 @@ describe("Organizations Users Endpoints", () => {
|
||||
membershipFixtures = new MembershipRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test org 2",
|
||||
name: `organizations-users-admin-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
@@ -243,9 +244,9 @@ describe("Organizations Users Endpoints", () => {
|
||||
{ userData },
|
||||
userData.map((u) => u.profile)
|
||||
);
|
||||
expect(userData.find((u) => u.profile.username === "[email protected]")).toBeDefined();
|
||||
expect(userData.find((u) => u.profile.username === "[email protected]")).toBeDefined();
|
||||
expect(userData.find((u) => u.profile.username === "[email protected]")).toBeDefined();
|
||||
expect(userData.find((u) => u.profile.username === orgMembersData[0].username)).toBeDefined();
|
||||
expect(userData.find((u) => u.profile.username === orgMembersData[1].username)).toBeDefined();
|
||||
expect(userData.find((u) => u.profile.username === orgMembersData[2].username)).toBeDefined();
|
||||
|
||||
expect(userData.filter((user: { email: string }) => user.email === nonMemberEmail).length).toBe(0);
|
||||
});
|
||||
@@ -304,7 +305,7 @@ describe("Organizations Users Endpoints", () => {
|
||||
|
||||
it("should create a new org user", async () => {
|
||||
const newOrgUser = {
|
||||
email: "[email protected]",
|
||||
email: `organizations-users-new-member-${randomString()}@api.com`,
|
||||
organizationRole: "MEMBER",
|
||||
autoAccept: true,
|
||||
};
|
||||
@@ -327,7 +328,7 @@ describe("Organizations Users Endpoints", () => {
|
||||
usernameOrEmail: newOrgUser.email,
|
||||
orgName: org.name,
|
||||
orgId: org.id,
|
||||
inviterName: "[email protected]",
|
||||
inviterName: userEmail,
|
||||
locale: null,
|
||||
});
|
||||
createdUser = userData;
|
||||
@@ -366,7 +367,7 @@ describe("Organizations Users Endpoints", () => {
|
||||
let membershipFixtures: MembershipRepositoryFixture;
|
||||
let profileRepositoryFixture: ProfileRepositoryFixture;
|
||||
|
||||
const authEmail = "[email protected]";
|
||||
const authEmail = `organizations-users-auth-${randomString()}@api.com`;
|
||||
let user: User;
|
||||
let org: Team;
|
||||
let team: Team;
|
||||
@@ -390,12 +391,12 @@ describe("Organizations Users Endpoints", () => {
|
||||
profileRepositoryFixture = new ProfileRepositoryFixture(moduleRef);
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test org 4",
|
||||
name: `organizations-users-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
team = await teamsRepositoryFixture.create({
|
||||
name: "Test org 4 team",
|
||||
name: `organizations-users-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
parent: { connect: { id: org.id } },
|
||||
});
|
||||
@@ -464,7 +465,7 @@ describe("Organizations Users Endpoints", () => {
|
||||
|
||||
it("should create a new org user with team event-types", async () => {
|
||||
const newOrgUser = {
|
||||
email: "[email protected]",
|
||||
email: `organizations-users-new-member-${randomString()}@api.com`,
|
||||
organizationRole: "MEMBER",
|
||||
autoAccept: true,
|
||||
};
|
||||
|
||||
+3
-2
@@ -17,13 +17,14 @@ import { MembershipRepositoryFixture } from "test/fixtures/repository/membership
|
||||
import { OrganizationRepositoryFixture } from "test/fixtures/repository/organization.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { WebhookRepositoryFixture } from "test/fixtures/repository/webhooks.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { Team, Webhook } from "@calcom/prisma/client";
|
||||
|
||||
describe("WebhooksController (e2e)", () => {
|
||||
let app: INestApplication;
|
||||
const userEmail = "webhook-controller-e2e@api.com";
|
||||
const userEmail = `organizations-webhooks-admin-${randomString()}@api.com`;
|
||||
let org: Team;
|
||||
|
||||
let organizationsRepositoryFixture: OrganizationRepositoryFixture;
|
||||
@@ -53,7 +54,7 @@ describe("WebhooksController (e2e)", () => {
|
||||
});
|
||||
|
||||
org = await organizationsRepositoryFixture.create({
|
||||
name: "Test Organization",
|
||||
name: `organizations-webhooks-organization-${randomString()}`,
|
||||
isOrganization: true,
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import { BookingsRepositoryFixture } from "test/fixtures/repository/bookings.rep
|
||||
import { EventTypesRepositoryFixture } from "test/fixtures/repository/event-types.repository.fixture";
|
||||
import { SelectedSlotsRepositoryFixture } from "test/fixtures/repository/selected-slots.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomNumber } from "test/utils/randomNumber";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -251,7 +251,7 @@ describe("Slots Endpoints", () => {
|
||||
let selectedSlotsRepositoryFixture: SelectedSlotsRepositoryFixture;
|
||||
let bookingsRepositoryFixture: BookingsRepositoryFixture;
|
||||
|
||||
const userEmail = `slots-${randomNumber()}[email protected]`;
|
||||
const userEmail = `slots-${randomString()}[email protected]`;
|
||||
const userName = "bob";
|
||||
let user: User;
|
||||
let eventTypeId: number;
|
||||
@@ -291,14 +291,23 @@ describe("Slots Endpoints", () => {
|
||||
});
|
||||
|
||||
// nxte(Lauris): this creates default schedule monday to friday from 9AM to 5PM in Europe/Rome timezone
|
||||
await schedulesService.createUserDefaultSchedule(user.id, "Europe/Rome");
|
||||
const userSchedule = await schedulesService.createUserSchedule(user.id, {
|
||||
name: `slots-schedule-${randomString()}-slots.controller.e2e-spec`,
|
||||
timeZone: "Europe/Rome",
|
||||
isDefault: true,
|
||||
});
|
||||
|
||||
const event = await eventTypesRepositoryFixture.create(
|
||||
{ title: "frisbee match", slug: "frisbee-match", length: 60 },
|
||||
const eventType = await eventTypesRepositoryFixture.create(
|
||||
{
|
||||
title: `slots-event-type-${randomString()}-slots.controller.e2e-spec`,
|
||||
slug: `slots-event-type-${randomString()}-slots.controller.e2e-spec`,
|
||||
length: 60,
|
||||
locations: [],
|
||||
},
|
||||
user.id
|
||||
);
|
||||
eventTypeId = event.id;
|
||||
eventTypeSlug = event.slug;
|
||||
eventTypeId = eventType.id;
|
||||
eventTypeSlug = eventType.slug;
|
||||
|
||||
app = moduleRef.createNestApplication();
|
||||
bootstrap(app as NestExpressApplication);
|
||||
|
||||
+13
-12
@@ -14,7 +14,7 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomNumber } from "test/utils/randomNumber";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
@@ -47,12 +47,12 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
let team: Team;
|
||||
let falseTestTeam: Team;
|
||||
|
||||
const userEmail = `auth-${randomNumber()}@api.com`;
|
||||
const userEmail = `teams-event-types-user-${randomString()}@api.com`;
|
||||
let userAdmin: User;
|
||||
|
||||
const teammate1Email = "[email protected]";
|
||||
const teammate2Email = "[email protected]";
|
||||
const falseTestUserEmail = "[email protected]";
|
||||
const teammate1Email = `teams-event-types-teammate1-${randomString()}@api.com`;
|
||||
const teammate2Email = `teams-event-types-teammate2-${randomString()}@api.com`;
|
||||
const falseTestUserEmail = `teams-event-types-false-user-${randomString()}@api.com`;
|
||||
let teamMember1: User;
|
||||
let teamMember2: User;
|
||||
let falseTestUser: User;
|
||||
@@ -97,12 +97,12 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
});
|
||||
|
||||
team = await teamsRepositoryFixture.create({
|
||||
name: "Test org team",
|
||||
name: `teams-event-types-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
});
|
||||
|
||||
falseTestTeam = await teamsRepositoryFixture.create({
|
||||
name: "Outside org team",
|
||||
name: `teams-event-types-false-team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
});
|
||||
|
||||
@@ -169,8 +169,8 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
|
||||
it("should create a collective team event-type", async () => {
|
||||
const body: CreateTeamEventTypeInput_2024_06_14 = {
|
||||
title: "Coding consultation collective",
|
||||
slug: "coding-consultation collective",
|
||||
title: `teams-event-types-collective-${randomString()}`,
|
||||
slug: `teams-event-types-collective-${randomString()}`,
|
||||
description: "Our team will review your codebase.",
|
||||
lengthInMinutes: 60,
|
||||
locations: [
|
||||
@@ -275,8 +275,8 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
|
||||
it("should create a managed team event-type", async () => {
|
||||
const body: CreateTeamEventTypeInput_2024_06_14 = {
|
||||
title: "Coding consultation managed",
|
||||
slug: "coding-consultation-managed",
|
||||
title: `teams-event-types-managed-${randomString()}`,
|
||||
slug: `teams-event-types-managed-${randomString()}`,
|
||||
description: "Our team will review your codebase.",
|
||||
lengthInMinutes: 60,
|
||||
locations: [
|
||||
@@ -316,6 +316,7 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
const teamEventTypes = await eventTypesRepositoryFixture.getAllTeamEventTypes(team.id);
|
||||
|
||||
expect(teammate1EventTypes.length).toEqual(1);
|
||||
expect(teammate1EventTypes[0].title).toEqual(body.title);
|
||||
expect(teammate2EventTypes.length).toEqual(1);
|
||||
expect(teamEventTypes.filter((eventType) => eventType.schedulingType === "MANAGED").length).toEqual(
|
||||
1
|
||||
@@ -423,7 +424,7 @@ describe("Organizations Event Types Endpoints", () => {
|
||||
});
|
||||
|
||||
it("should update managed event-type", async () => {
|
||||
const newTitle = "Coding consultation managed updated";
|
||||
const newTitle = `teams-event-types-managed-updated-${randomString()}`;
|
||||
const newHosts: UpdateTeamEventTypeInput_2024_06_14["hosts"] = [
|
||||
{
|
||||
userId: teamMember1.id,
|
||||
|
||||
+6
-6
@@ -24,7 +24,7 @@ import { OrganizationRepositoryFixture } from "test/fixtures/repository/organiza
|
||||
import { ProfileRepositoryFixture } from "test/fixtures/repository/profiles.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomNumber } from "test/utils/randomNumber";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { api } from "@calcom/app-store/alby";
|
||||
@@ -51,11 +51,11 @@ describe("Teams Memberships Endpoints", () => {
|
||||
let teamMemberMembership: Membership;
|
||||
let membershipCreatedViaApi: TeamMembershipOutput;
|
||||
|
||||
const teamAdminEmail = `alice-admin-${randomNumber()}@api.com`;
|
||||
const teamMemberEmail = `bob-member-${randomNumber()}@api.com`;
|
||||
const nonTeamUserEmail = `charlie-outsider-${randomNumber()}@api`;
|
||||
const teamAdminEmail = `alice-admin-${randomString()}@api.com`;
|
||||
const teamMemberEmail = `bob-member-${randomString()}@api.com`;
|
||||
const nonTeamUserEmail = `charlie-outsider-${randomString()}@api`;
|
||||
|
||||
const invitedUserEmail = `david-invited-${randomNumber()}@api.com`;
|
||||
const invitedUserEmail = `david-invited-${randomString()}@api.com`;
|
||||
|
||||
let teamAdmin: User;
|
||||
let teamMember: User;
|
||||
@@ -97,7 +97,7 @@ describe("Teams Memberships Endpoints", () => {
|
||||
});
|
||||
|
||||
team = await teamsRepositoryFixture.create({
|
||||
name: `Team-${randomNumber()}`,
|
||||
name: `Team-${randomString()}`,
|
||||
isOrganization: false,
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { ApiKeysRepositoryFixture } from "test/fixtures/repository/api-keys.repo
|
||||
import { MembershipRepositoryFixture } from "test/fixtures/repository/membership.repository.fixture";
|
||||
import { TeamRepositoryFixture } from "test/fixtures/repository/team.repository.fixture";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { randomNumber } from "test/utils/randomNumber";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
|
||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||
import { TeamOutputDto } from "@calcom/platform-types";
|
||||
@@ -29,11 +29,11 @@ describe("Teams endpoint", () => {
|
||||
let apiKeysRepositoryFixture: ApiKeysRepositoryFixture;
|
||||
let membershipRepositoryFixture: MembershipRepositoryFixture;
|
||||
|
||||
const aliceEmail = `alice-${randomNumber()}@api.com`;
|
||||
const aliceEmail = `alice-${randomString()}@api.com`;
|
||||
let alice: User;
|
||||
let aliceApiKey: string;
|
||||
|
||||
const bobEmail = `bob-${randomNumber()}@api.com`;
|
||||
const bobEmail = `bob-${randomString()}@api.com`;
|
||||
let bob: User;
|
||||
let bobApiKey: string;
|
||||
|
||||
@@ -75,7 +75,7 @@ describe("Teams endpoint", () => {
|
||||
describe("User has membership in created team", () => {
|
||||
it("should create a team", async () => {
|
||||
const body: CreateTeamInput = {
|
||||
name: "Team dog",
|
||||
name: `teams-dog-${randomString()}`,
|
||||
};
|
||||
|
||||
return request(app.getHttpServer())
|
||||
@@ -96,7 +96,7 @@ describe("Teams endpoint", () => {
|
||||
|
||||
it("should create a team", async () => {
|
||||
const body: CreateTeamInput = {
|
||||
name: "Team cats",
|
||||
name: `teams-cats-${randomString()}`,
|
||||
};
|
||||
|
||||
return request(app.getHttpServer())
|
||||
@@ -148,7 +148,7 @@ describe("Teams endpoint", () => {
|
||||
|
||||
it("should update a team", async () => {
|
||||
const body: UpdateTeamDto = {
|
||||
name: "Team dogs shepherds",
|
||||
name: `teams-dogs-shepherds-${randomString()}`,
|
||||
};
|
||||
|
||||
return request(app.getHttpServer())
|
||||
@@ -223,6 +223,7 @@ describe("Teams endpoint", () => {
|
||||
|
||||
afterAll(async () => {
|
||||
await userRepositoryFixture.deleteByEmail(aliceEmail);
|
||||
await userRepositoryFixture.deleteByEmail(bobEmail);
|
||||
await teamRepositoryFixture.delete(team1.id);
|
||||
await teamRepositoryFixture.delete(team2.id);
|
||||
await app.close();
|
||||
|
||||
@@ -15,13 +15,14 @@ import { Test } from "@nestjs/testing";
|
||||
import * as request from "supertest";
|
||||
import { UserRepositoryFixture } from "test/fixtures/repository/users.repository.fixture";
|
||||
import { WebhookRepositoryFixture } from "test/fixtures/repository/webhooks.repository.fixture";
|
||||
import { randomString } from "test/utils/randomString";
|
||||
import { withApiAuth } from "test/utils/withApiAuth";
|
||||
|
||||
import { Webhook } from "@calcom/prisma/client";
|
||||
|
||||
describe("WebhooksController (e2e)", () => {
|
||||
let app: INestApplication;
|
||||
const userEmail = "webhook-controller-e2e@api.com";
|
||||
const userEmail = `webhooks-controller-user-${randomString()}@api.com`;
|
||||
let user: UserWithProfile;
|
||||
let otherUser: UserWithProfile;
|
||||
|
||||
@@ -47,8 +48,8 @@ describe("WebhooksController (e2e)", () => {
|
||||
});
|
||||
|
||||
otherUser = await userRepositoryFixture.create({
|
||||
email: "other-user-webhook-controller@api.com",
|
||||
username: "other-user-webhook-controller@api.com",
|
||||
email: `webhooks-controller-other-user-${randomString()}@api.com`,
|
||||
username: `webhooks-controller-other-user-${randomString()}@api.com`,
|
||||
});
|
||||
|
||||
otherWebhook = await webhookRepositoryFixture.create({
|
||||
|
||||
Reference in new issue
Block a user