Building helpers for prisma mocks

fix/credential-sync-app-lookup-tests
Keith Williams 2023-09-26 09:03:48 -03:00
parent b52c2c3d07
commit 289a60ba3a
2 changed files with 4 additions and 10 deletions

View File

@ -6,7 +6,7 @@ import { createMocks } from "node-mocks-http";
import { afterAll, describe, expect, test, vi } from "vitest";
import { symmetricEncrypt } from "@calcom/lib/crypto";
import { buildApp, buildUser } from "@calcom/lib/test/builder";
import { buildUser } from "@calcom/lib/test/builder";
import prisma from "@calcom/prisma";
import handler from "../../../../pages/api/webhook/app-credential";
@ -57,13 +57,7 @@ describe("app-credential webhook", () => {
})
);
prismaMock.app.findUnique.mockResolvedValue(
buildApp({
slug: "office365-calendar",
dirName: "office365calendar",
keys: "test-keys",
})
);
prismaMock.app.findUnique.mockResolvedValue({ dirName: "office365calendar" });
await handler(req, res);

View File

@ -235,8 +235,8 @@ export const buildApp = (app?: Partial<App>): App => {
updatedAt: new Date(),
credentials: null,
payments: null,
Webhook: null,
ApiKey: null,
webhooks: null,
apiKeys: null,
enabled: true,
...app,
};