Merge branch 'main' into fix/after-meeting-ends-migration

This commit is contained in:
kodiakhq[bot] 2022-08-29 22:36:56 +00:00 committed by GitHub
commit aecee5efda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 152 additions and 77 deletions

View File

@ -1,26 +0,0 @@
import type { Config } from "@jest/types";
const config: Config.InitialOptions = {
preset: "ts-jest",
clearMocks: true,
setupFilesAfterEnv: ["../../tests/config/singleton.ts"],
verbose: true,
roots: ["<rootDir>"],
setupFiles: ["<rootDir>/test/jest-setup.js"],
testMatch: ["**/test/lib/**/*.(spec|test).(ts|tsx|js)", "**/__tests__/**/*.(spec|test).(ts|tsx|js)"],
testPathIgnorePatterns: ["<rootDir>/.next", "<rootDir>/playwright/"],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }],
},
transformIgnorePatterns: ["/node_modules/", "^.+\\.module\\.(css|sass|scss)$"],
testEnvironment: "jsdom",
resolver: `<rootDir>/test/jest-resolver.js`,
moduleNameMapper: {
"^@components(.*)$": "<rootDir>/components$1",
"^@lib(.*)$": "<rootDir>/lib$1",
"^@server(.*)$": "<rootDir>/server$1",
"^@ee(.*)$": "<rootDir>/ee$1",
},
};
export default config;

View File

@ -9,7 +9,6 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
"dev": "next dev",
"dx": "yarn dev",
"test": "dotenv -e ./test/.env.test -- jest",
"test-e2e": "NEXT_PUBLIC_IS_E2E=1 yarn playwright test --config=../../tests/config/playwright.config.ts --project=chromium",
"test-e2e-integrations": "NEXT_PUBLIC_IS_E2E=1 yarn playwright test --config=playwright-integrations/config/playwright.config.ts --project=chromium",
"test-e2e-integrations-quick": "QUICK=true E2E_DEV_SERVER=1 yarn test-e2e-integrations",
@ -137,7 +136,6 @@
"@types/bcryptjs": "^2.4.2",
"@types/detect-port": "^1.3.2",
"@types/glidejs__glide": "^3.4.2",
"@types/jest": "^28.1.7",
"@types/lodash": "^4.14.182",
"@types/markdown-it": "^12.2.3",
"@types/memory-cache": "^0.2.2",
@ -159,9 +157,6 @@
"copy-webpack-plugin": "^11.0.0",
"env-cmd": "^10.1.0",
"eslint": "^8.20.0",
"jest": "^28.1.0",
"jest-environment-jsdom": "^28.1.3",
"jest-mock-extended": "^2.0.7",
"mockdate": "^3.0.5",
"module-alias": "^2.2.2",
"msw": "^0.42.3",

View File

@ -13,6 +13,10 @@ import { prismaMock } from "../../../../tests/config/singleton";
prismaMock.eventType.findUnique.mockResolvedValue(null);
prismaMock.user.findMany.mockResolvedValue([]);
jest.mock("@calcom/lib/constants", () => ({
IS_PRODUCTION: true,
}));
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace jest {

61
jest.config.ts Normal file
View File

@ -0,0 +1,61 @@
import type { Config } from "jest";
const config: Config = {
preset: "ts-jest",
verbose: true,
projects: [
{
displayName: "@calcom/web",
roots: ["<rootDir>/apps/web"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
modulePathIgnorePatterns: [
//
"<rootDir>/apps/web/test/__fixtures__",
"<rootDir>/apps/web/node_modules",
"<rootDir>/apps/web/dist",
],
clearMocks: true,
setupFilesAfterEnv: ["<rootDir>/tests/config/singleton.ts"],
setupFiles: ["<rootDir>/apps/web/test/jest-setup.js"],
testMatch: ["**/test/lib/**/*.(spec|test).(ts|tsx|js)", "**/__tests__/**/*.(spec|test).(ts|tsx|js)"],
testPathIgnorePatterns: ["<rootDir>/apps/web/.next", "<rootDir>/apps/web/playwright/"],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }],
},
transformIgnorePatterns: ["/node_modules/", "^.+\\.module\\.(css|sass|scss)$"],
testEnvironment: "jsdom",
resolver: `<rootDir>/apps/web/test/jest-resolver.js`,
moduleNameMapper: {
"^@components(.*)$": "<rootDir>/apps/web/components$1",
"^@lib(.*)$": "<rootDir>/apps/web/lib$1",
"^@server(.*)$": "<rootDir>/apps/web/server$1",
},
},
{
displayName: "@calcom/lib",
roots: ["<rootDir>/packages/lib"],
testEnvironment: "node",
transform: {
"^.+\\.tsx?$": "ts-jest",
},
},
{
displayName: "@calcom/closecom",
roots: ["<rootDir>/packages/app-store/closecomothercalendar"],
testMatch: ["**/test/lib/**/*.(spec|test).(ts|tsx|js)"],
transform: {
"^.+\\.ts?$": "ts-jest",
},
transformIgnorePatterns: ["/node_modules/", "^.+\\.module\\.(css|sass|scss)$"],
testEnvironment: "jsdom",
setupFiles: ["<rootDir>/packages/app-store/closecomothercalendar/test/globals.ts"],
},
],
watchPlugins: [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname",
"jest-watch-select-projects",
],
};
export default config;

View File

@ -12,14 +12,15 @@
],
"scripts": {
"app-e2e-quick": "turbo run app-e2e-quick",
"app-store:build": "yarn workspace @calcom/app-store-cli build",
"app-store:watch": "yarn workspace @calcom/app-store-cli watch",
"app-store": "yarn workspace @calcom/app-store-cli cli",
"app-store-cli": "yarn workspace @calcom/app-store-cli",
"app-store:build": "yarn app-store-cli build",
"app-store:watch": "yarn app-store-cli watch",
"app-store": "yarn app-store-cli cli",
"build": "turbo run build --scope=\"@calcom/web\" --include-dependencies",
"clean": "find . -name node_modules -o -name .next -o -name .turbo -o -name dist -type d -prune | xargs rm -rf",
"db-deploy": "turbo run db-deploy",
"db-seed": "turbo run db-seed",
"db-studio": "yarn workspace @calcom/prisma db-studio",
"db-studio": "yarn prisma studio",
"deploy": "turbo run deploy",
"dev:all": "turbo run dev --scope=\"@calcom/web\" --scope=\"@calcom/website\" --scope=\"@calcom/console\"",
"dev:api": "turbo run dev --scope=\"@calcom/web\" --scope=\"@calcom/api\"",
@ -47,19 +48,28 @@
"prepare": "husky install",
"prisma": "yarn workspace @calcom/prisma prisma",
"start": "turbo run start --scope=\"@calcom/web\"",
"tdd": "jest --watch",
"test-e2e": "turbo run test --scope=\"@calcom/web\" && yarn turbo run test-e2e --scope=\"@calcom/web\" --concurrency=1",
"test-playwright": "yarn playwright test --config=tests/config/playwright.config.ts",
"test": "turbo run test",
"test": "jest",
"turbo-w": "node turbo-wrapper.js",
"type-check": "turbo run type-check",
"test-e2e-integrations": "turbo run test-e2e-integrations --scope=\"@calcom/web\" --concurrency=1"
"test-e2e-integrations": "turbo run test-e2e-integrations --scope=\"@calcom/web\" --concurrency=1",
"web": "yarn workspace @calcom/web"
},
"devDependencies": {
"@snaplet/copycat": "^0.3.0",
"@types/jest": "^28.1.7",
"dotenv-checker": "^1.1.5",
"husky": "^8.0.1",
"jest-environment-jsdom": "^28.1.3",
"jest-mock-extended": "^2.0.7",
"jest-watch-select-projects": "^2.0.0",
"jest-watch-typeahead": "^2.0.0",
"jest": "^28.1.0",
"lint-staged": "^12.5.0",
"prettier": "^2.7.1"
"prettier": "^2.7.1",
"ts-jest": "^28.0.8"
},
"dependencies": {
"turbo": "^1.4.3"

View File

@ -1,15 +0,0 @@
import type { Config } from "@jest/types";
const config: Config.InitialOptions = {
verbose: true,
roots: ["<rootDir>"],
testMatch: ["**/test/lib/**/*.(spec|test).(ts|tsx|js)"],
transform: {
"^.+\\.ts?$": "ts-jest",
},
transformIgnorePatterns: ["/node_modules/", "^.+\\.module\\.(css|sass|scss)$"],
testEnvironment: "jsdom",
setupFiles: ["<rootDir>/test/globals.ts"],
};
export default config;

View File

@ -14,9 +14,6 @@
"@calcom/prisma": "*"
},
"devDependencies": {
"@calcom/types": "*",
"@types/jest": "^28.1.7",
"jest": "^28.1.0",
"ts-jest": "^28.0.8"
"@calcom/types": "*"
}
}

View File

@ -7,13 +7,13 @@ import {
} from "@calcom/lib/CloseComeUtils";
import { CalendarEvent } from "@calcom/types/Calendar";
jest.mock("@calcom/lib/CloseCom", () => {
return class {
jest.mock("@calcom/lib/CloseCom", () => ({
default: class {
constructor() {
/* Mock */
}
};
});
},
}));
afterEach(() => {
jest.resetAllMocks();

View File

@ -1,4 +0,0 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
};

View File

@ -6,7 +6,6 @@
"types": "./index.ts",
"license": "MIT",
"scripts": {
"test": "dotenv -e ./test/.env.test -- jest",
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",
"lint:fix": "eslint . --ext .ts,.js,.tsx,.jsx --fix",
"lint:report": "eslint . --format json --output-file ../../lint-results/app-store.json"
@ -30,8 +29,6 @@
"@calcom/tsconfig": "*",
"@calcom/types": "*",
"@faker-js/faker": "^7.3.0",
"jest": "^28.1.0",
"ts-jest": "^28.0.8",
"typescript": "^4.7.4"
}
}

View File

@ -1,8 +1,17 @@
import { faker } from "@faker-js/faker";
import { getPublicVideoCallUrl, getLocation, getVideoCallPassword, getVideoCallUrl } from "../CalEventParser";
import { getLocation, getPublicVideoCallUrl, getVideoCallPassword, getVideoCallUrl } from "../CalEventParser";
import { buildCalendarEvent, buildVideoCallData } from "./builder";
jest.mock("@calcom/lib/constants", () => ({
WEBAPP_URL: "http://localhost:3000",
}));
jest.mock("short-uuid", () => ({
__esModule: true,
default: () => ({ fromUUID: () => "FAKE_UUID" }),
}));
describe("getLocation", () => {
it("should return a meetingUrl for video call meetings", () => {
const calEvent = buildCalendarEvent({

View File

@ -1,6 +1,5 @@
import prisma from ".";
require("dotenv").config({ path: "../../.env" });
// TODO: Put some restrictions here to run it on local DB only.
// Production DB currently doesn't support app deletion
async function main() {

View File

@ -11,8 +11,6 @@ import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "@calcom/lib/avail
import prisma from ".";
import mainAppStore from "./seed-app-store";
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("dotenv").config({ path: "../../.env" });
async function createUserAndEventType(opts: {
user: {
email: string;

View File

@ -7292,6 +7292,13 @@ ansi-escapes@^4.2.1, ansi-escapes@^4.3.0:
dependencies:
type-fest "^0.21.3"
ansi-escapes@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-5.0.0.tgz#b6a0caf0eef0c41af190e9a749e0c00ec04bb2a6"
integrity sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==
dependencies:
type-fest "^1.0.2"
ansi-html-community@0.0.8, ansi-html-community@^0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41"
@ -8836,6 +8843,14 @@ chalk@^2.0.0, chalk@^2.4.1:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
chalk@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
change-case@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/change-case/-/change-case-2.3.1.tgz#2c4fde3f063bb41d00cd68e0d5a09db61cbe894f"
@ -8863,6 +8878,11 @@ char-regex@^1.0.2:
resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf"
integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==
char-regex@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-2.0.1.tgz#6dafdb25f9d3349914079f010ba8d0e6ff9cd01e"
integrity sha512-oSvEeo6ZUD7NepqAat3RqoucZ5SeqLJgOvVIwkafu6IP3V0pO38s/ypdVUmDDK6qIIHNlYHJAKX9E7R7HoKElw==
character-entities-html4@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/character-entities-html4/-/character-entities-html4-2.1.0.tgz#1f1adb940c971a4b22ba39ddca6b618dc6e56b2b"
@ -14721,7 +14741,7 @@ jest-regex-util@^26.0.0:
resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28"
integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==
jest-regex-util@^28.0.2:
jest-regex-util@^28.0.0, jest-regex-util@^28.0.2:
version "28.0.2"
resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-28.0.2.tgz#afdc377a3b25fb6e80825adcf76c854e5bf47ead"
integrity sha512-4s0IgyNIy0y9FK+cjoVYoxamT7Zeo7MhzqRGx7YDYmaQn1wucY9rotiGkBzzcMXTtjrCAP/f7f+E0F7+fxPNdw==
@ -14877,7 +14897,29 @@ jest-validate@^28.1.3:
leven "^3.1.0"
pretty-format "^28.1.3"
jest-watcher@^28.1.3:
jest-watch-select-projects@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/jest-watch-select-projects/-/jest-watch-select-projects-2.0.0.tgz#4373d7e4de862aae28b46e036b669a4c913ea867"
integrity sha512-j00nW4dXc2NiCW6znXgFLF9g8PJ0zP25cpQ1xRro/HU2GBfZQFZD0SoXnAlaoKkIY4MlfTMkKGbNXFpvCdjl1w==
dependencies:
ansi-escapes "^4.3.0"
chalk "^3.0.0"
prompts "^2.2.1"
jest-watch-typeahead@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-2.0.0.tgz#1808eb9462a5887e3c65fdaacf3c537211609955"
integrity sha512-LX/jrTNkOIZV1n7fnEWlKJ73lhVPKF9B6F0L7pbje3xNPw1NddPLn0n8EFt7YwbCnC0+vlLylp7JehV6M06J6Q==
dependencies:
ansi-escapes "^5.0.0"
chalk "^4.0.0"
jest-regex-util "^28.0.0"
jest-watcher "^28.0.0"
slash "^4.0.0"
string-length "^5.0.1"
strip-ansi "^7.0.1"
jest-watcher@^28.0.0, jest-watcher@^28.1.3:
version "28.1.3"
resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-28.1.3.tgz#c6023a59ba2255e3b4c57179fc94164b3e73abd4"
integrity sha512-t4qcqj9hze+jviFPUN3YAtAEeFnr/azITXQEMARf5cMwKY2SMBRnCQTXLixTl20OR6mLh9KLMrgVJgJISym+1g==
@ -18962,7 +19004,7 @@ promise.prototype.finally@^3.1.0:
define-properties "^1.1.3"
es-abstract "^1.19.1"
prompts@^2.0.1, prompts@^2.4.0:
prompts@^2.0.1, prompts@^2.2.1, prompts@^2.4.0:
version "2.4.2"
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069"
integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==
@ -19265,7 +19307,7 @@ raw-body@2.4.3:
iconv-lite "0.4.24"
unpipe "1.0.0"
raw-body@2.5.1:
raw-body@2.5.1, raw-body@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857"
integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==
@ -21356,6 +21398,14 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"
string-length@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/string-length/-/string-length-5.0.1.tgz#3d647f497b6e8e8d41e422f7e0b23bc536c8381e"
integrity sha512-9Ep08KAMUn0OadnVaBuRdE2l615CQ508kr0XMadjClfYpdCyvrbFp6Taebo8yyxokQ4viUd/xPPUA4FGgUa0ow==
dependencies:
char-regex "^2.0.0"
strip-ansi "^7.0.1"
string-width@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
@ -22640,7 +22690,7 @@ type-fest@^0.8.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
type-fest@^1.2.2:
type-fest@^1.0.2, type-fest@^1.2.2:
version "1.4.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1"
integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==