Scheduling infrastructure for absolutely everyone.
feat: 100% code-coverage, add coverage to gitignore
Agusti Fernandez Pardoa71039328f9c
diff --git a/.gitignore b/.gitignoreindex f1476ef06aa..a50ad511f98 100644--- a/.gitignore+++ b/.gitignore@@ -1,6 +1,71 @@-dist-node_modules/+# .env file.env++# dependencies+node_modules+.pnp+.pnp.js++# testing+coverage+/test-results/+playwright/videos+playwright/screenshots+playwright/artifacts+playwright/results+playwright/reports/*++# next.js.next/-.turbo/-*.tsbuildinfo+out/+build++# misc+.DS_Store+*.pem++# debug+npm-debug.log*+yarn-debug.log*+yarn-error.log*+.pnpm-debug.log*++# local env files+.env.local+.env.development.local+.env.test.local+.env.production.local+.env.*+!.env.example++# vercel+.vercel++# Webstorm+.idea++### VisualStudioCode template+.vscode/*+!.vscode/settings.json+!.vscode/tasks.json+!.vscode/launch.json+!.vscode/extensions.json+*.code-workspace++# Local History for Visual Studio Code+.history/++# Typescript+tsconfig.tsbuildinfo++# turbo+.turbo++# Prisma-Zod+packages/prisma/zod/*.ts++# Builds+dist++# Linting+lint-resultsdiff --git a/__tests__/event-types/[id]/index.test.ts b/__tests__/event-types/[id]/index.test.tsindex 4c3cfc655b0..3420d221f1c 100644--- a/__tests__/event-types/[id]/index.test.ts+++ b/__tests__/event-types/[id]/index.test.ts@@ -4,11 +4,6 @@ import prisma from "@calcom/prisma";import handleEvent from "../../../pages/api/event-types/[id]";-afterAll((done) => {- prisma.$disconnect().then();- done();-});-describe("GET /api/event-types/[id] with valid id as string returns an event-type", () => {it("returns a message with the specified events", async () => {const { req, res } = createMocks({@@ -79,3 +74,25 @@ describe("POST /api/event-types/[id] fails, only GET allowed", () => {expect(JSON.parse(res._getData())).toStrictEqual({ error: "Only GET Method allowed" });});});++describe("PATCH /api/event-types/[id]/edit with valid id and body updates an event-type", () => {+ it("returns a message with the specified events", async () => {+ const { req, res } = createMocks({+ method: "PATCH",+ query: {+ id: "1",+ },+ });+ const event = await prisma.eventType.findUnique({ where: { id: 1 } });+ await handleEvent(req, res);++ expect(res._getStatusCode()).toBe(200);+ if (event) event.title = "Updated title";+ expect(JSON.parse(res._getData())).toStrictEqual({ data: event });+ });+});++afterAll((done) => {+ prisma.$disconnect().then();+ done();+});diff --git a/jest.config.ts b/jest.config.tsindex 48bf90223af..1abd4994a80 100644--- a/jest.config.ts+++ b/jest.config.ts@@ -3,16 +3,7 @@* https://jestjs.io/docs/en/configuration.html*/-export default {- // All imported modules in your tests should be mocked automatically- // automock: false,-- // Stop running tests after `n` failures- // bail: 0,-- // The directory where Jest should store its cached dependency information- // cacheDirectory: "/private/var/folders/fl/sw088bcs0dx4zyy0f_ghzvwc0000gn/T/jest_dx",-+const config = {// Automatically clear mock calls and instances between every testclearMocks: true,@@ -24,6 +15,7 @@ export default {// The directory where Jest should output its coverage filescoverageDirectory: "coverage",+ collectCoverage: true,// An array of regexp pattern strings used to skip coverage collection// coveragePathIgnorePatterns: [@@ -133,64 +125,12 @@ export default {// setupFilesAfterEnv: [],// The number of seconds after which a test is considered as slow and reported as such in the results.- // slowTestThreshold: 5,+ slowTestThreshold: 1,// A list of paths to snapshot serializer modules Jest should use for snapshot testing// snapshotSerializers: [],// The test environment that will be used for testingtestEnvironment: "node",-- // Options that will be passed to the testEnvironment- // testEnvironmentOptions: {},-- // Adds a location field to test results- // testLocationInResults: false,-- // The glob patterns Jest uses to detect test files- // testMatch: [- // "**/__tests__/**/*.[jt]s?(x)",- // "**/?(*.)+(spec|test).[tj]s?(x)"- // ],-- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped- // testPathIgnorePatterns: [- // "/node_modules/"- // ],-- // The regexp pattern or array of patterns that Jest uses to detect test files- // testRegex: [],-- // This option allows the use of a custom results processor- // testResultsProcessor: undefined,-- // This option allows use of a custom test runner- // testRunner: "jasmine2",-- // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href- // testURL: "http://localhost",-- // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"- // timers: "real",-- // A map from regular expressions to paths to transformers- // transform: undefined,-- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation- // transformIgnorePatterns: [- // "/node_modules/",- // "\\.pnp\\.[^\\/]+$"- // ],-- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them- // unmockedModulePathPatterns: undefined,-- // Indicates whether each individual test should be reported during the run- // verbose: undefined,-- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode- // watchPathIgnorePatterns: [],-- // Whether to use watchman for file crawling- // watchman: true,};+export default config;