Apply suggestions from code review
parent
e457c13906
commit
eb35edce74
|
@ -14,6 +14,7 @@ import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
|
|||
import logger from "@calcom/lib/logger";
|
||||
import type { SchedulingType } from "@calcom/prisma/enums";
|
||||
import type { BookingStatus } from "@calcom/prisma/enums";
|
||||
import type { EventBusyDate } from "@calcom/types/Calendar";
|
||||
import type { Fixtures } from "@calcom/web/test/fixtures/fixtures";
|
||||
|
||||
import appStoreMock from "../../../../tests/libs/__mocks__/app-store";
|
||||
|
@ -568,8 +569,9 @@ export function mockNoTranslations() {
|
|||
});
|
||||
}
|
||||
|
||||
export function mockCalendarToHaveNoBusySlots(metadataLookupKey: string) {
|
||||
appStoreMock.default[metadataLookupKey].mockResolvedValue({
|
||||
export function mockCalendarToHaveNoBusySlots(metadataLookupKey: keyof typeof appStoreMetadata) {
|
||||
const appStoreLookupKey = metadataLookupKey;
|
||||
appStoreMock.default[appStoreLookupKey as keyof typeof appStoreMock.default].mockResolvedValue({
|
||||
lib: {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
//@ts-ignore
|
||||
|
@ -583,7 +585,7 @@ export function mockCalendarToHaveNoBusySlots(metadataLookupKey: string) {
|
|||
url: "http://dailyvideo.example.com",
|
||||
});
|
||||
},
|
||||
getAvailability: (...args): Promise<EventBusyDate[]> => {
|
||||
getAvailability: (): Promise<EventBusyDate[]> => {
|
||||
return new Promise((resolve) => {
|
||||
resolve([]);
|
||||
});
|
||||
|
@ -612,7 +614,6 @@ export function mockSuccessfulVideoMeetingCreation({
|
|||
//@ts-ignore
|
||||
VideoApiAdapter: () => ({
|
||||
createMeeting: () => {
|
||||
console.log("CALLING MOCKED DAILY");
|
||||
return Promise.resolve({
|
||||
type: appStoreMetadata[metadataLookupKey as keyof typeof appStoreMetadata].type,
|
||||
id: "MOCK_ID",
|
||||
|
@ -658,7 +659,7 @@ export function expectWebhookToHaveBeenCalledWith(
|
|||
subscriberUrl: string,
|
||||
data: {
|
||||
triggerEvent: WebhookTriggerEvents;
|
||||
payload: { metadata: any; responses: any };
|
||||
payload: { metadata: Record<string, unknown>; responses: Record<string, unknown> };
|
||||
}
|
||||
) {
|
||||
const fetchCalls = fetchMock.mock.calls;
|
||||
|
|
|
@ -10,7 +10,6 @@ import { appKeysSchema as calVideoKeysSchema } from "@calcom/app-store/dailyvide
|
|||
import { getEventLocationTypeFromApp } from "@calcom/app-store/locations";
|
||||
import { MeetLocationType } from "@calcom/app-store/locations";
|
||||
import getApps from "@calcom/app-store/utils";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { createdEventSchema } from "@calcom/prisma/zod-utils";
|
||||
import type { NewCalendarEventType } from "@calcom/types/Calendar";
|
||||
|
@ -121,13 +120,13 @@ export default class EventManager {
|
|||
evt["location"] = "integrations:daily";
|
||||
}
|
||||
const isDedicated = evt.location ? isDedicatedIntegration(evt.location) : null;
|
||||
|
||||
|
||||
const results: Array<EventResult<Exclude<Event, AdditionalInformation>>> = [];
|
||||
|
||||
// If and only if event type is a dedicated meeting, create a dedicated video meeting.
|
||||
if (isDedicated) {
|
||||
const result = await this.createVideoEvent(evt);
|
||||
|
||||
|
||||
if (result?.createdEvent) {
|
||||
evt.videoCallData = result.createdEvent;
|
||||
evt.location = result.originalEvent.location;
|
||||
|
|
|
@ -27,6 +27,7 @@ const getVideoAdapters = async (withCredentials: CredentialPayload[]): Promise<V
|
|||
|
||||
// Static Link Video Apps don't exist in packages/app-store/index.ts(it's manually maintained at the moment) and they aren't needed there anyway.
|
||||
const app = appImportFn ? await appImportFn() : null;
|
||||
|
||||
if (!app) {
|
||||
log.error(`Couldn't get adapter for ${appName}`);
|
||||
continue;
|
||||
|
@ -95,6 +96,7 @@ const createMeeting = async (credential: CredentialWithAppName, calEvent: Calend
|
|||
} catch (err) {
|
||||
await sendBrokenIntegrationEmail(calEvent, "video");
|
||||
console.error("createMeeting failed", err, calEvent);
|
||||
|
||||
// Default to calVideo
|
||||
const defaultMeeting = await createMeetingWithCalVideo(calEvent);
|
||||
if (defaultMeeting) {
|
||||
|
|
|
@ -42,7 +42,7 @@ export default class BaseEmail {
|
|||
console.log(
|
||||
"Skipped Sending Email as process.env.NEXT_PUBLIC_UNIT_TESTS is set. Emails are available in globalThis.testEmails"
|
||||
);
|
||||
return new Promise((r) => r("Skipped sendEmail for E2E"));
|
||||
return new Promise((r) => r("Skipped sendEmail for Unit Tests"));
|
||||
}
|
||||
|
||||
const payload = this.getNodeMailerPayload();
|
||||
|
|
|
@ -983,9 +983,6 @@ async function handler(
|
|||
}
|
||||
: getLocationValueForDB(locationBodyString, eventType.locations);
|
||||
|
||||
console.log("handleNewBooking", {
|
||||
bookingLocation,
|
||||
});
|
||||
const customInputs = getCustomInputsResponses(reqBody, eventType.customInputs);
|
||||
const teamDestinationCalendars: DestinationCalendar[] = [];
|
||||
|
||||
|
|
|
@ -309,6 +309,7 @@
|
|||
"ZOHOCRM_CLIENT_ID",
|
||||
"ZOHOCRM_CLIENT_SECRET",
|
||||
"ZOOM_CLIENT_ID",
|
||||
"ZOOM_CLIENT_SECRET"
|
||||
"ZOOM_CLIENT_SECRET",
|
||||
"NEXT_PUBLIC_UNIT_TESTS"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue