One jest to rule them all (#3957)
* WIP * Consolidates jest deps * Test fixes * Moves jest to root * Test fixes * Update CalendarService.test.ts * Cleanup Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
54bd1436b1
commit
037410aea7
14 files changed
+152
-77
No files matched your search
@@ -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;
|
||||
@@ -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": "*"
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
module.exports = {
|
||||
preset: "ts-jest",
|
||||
testEnvironment: "node",
|
||||
};
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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({
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user