test/msw-gcal
Joe Au-Yeung 2023-09-20 22:56:18 -04:00
parent 6fa2726537
commit 70531b202d
5 changed files with 0 additions and 71 deletions

View File

@ -1,15 +0,0 @@
# Set the version of docker compose to use
version: "3.9"
# The containers that compose the project
services:
db:
image: postgres:13
restart: always
container_name: integration-tests-prisma
ports:
- "5433:5432"
environment:
POSTGRES_USER: prisma
POSTGRES_PASSWORD: prisma
POSTGRES_DB: tests

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
# scripts/setenv.sh
# Export env vars
export $(grep -v '^#' .env | xargs)

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
DIR="$(cd "$(dirname "$0")" && pwd)"
source $DIR/setenv.sh

View File

@ -1,32 +0,0 @@
import prisma from "@calcom/prisma"
import { createMocks } from "node-mocks-http";
import type { CustomNextApiRequest, CustomNextApiResponse } from "@calcom/lib/test/types";
import dayjs from "@calcom/dayjs";
import { default as handleNewBooking } from "@calcom/features/bookings/lib/handleNewBooking";
test("API call to handleNewBooking", async () => {
const { req, res } = createMocks<CustomNextApiRequest, CustomNextApiResponse>({
method: "POST",
body: {
name: "test",
start: dayjs().add(1, "hour").format(),
end: dayjs().add(1, "day").format(),
eventTypeId: 3,
email: "test@example.com",
location: "Cal.com Video",
timeZone: "America/Montevideo",
language: "en",
customInputs: [],
metadata: {},
userId: 4,
},
userId: 4,
prisma,
});
await handleNewBooking(req, res);
console.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
// expect(prismaMock.booking.create).toHaveBeenCalledTimes(1);
})

View File

@ -1,11 +0,0 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
// clearMocks: true,
// cache: false,
coverage: {
provider: "v8",
},
},
});