chore: remove code not needed in defaultResponder (#19976)

* 1 line change

* fix test
This commit is contained in:
Benny Joo authored and GitHub committed 2025-03-11 17:47:01 +00:00
1 parent eafb61f515
commit ff5c6de5da
2 files changed
+3 -4

No files matched your search

@@ -1,4 +1,4 @@
import type { NextRequest } from "next/server";
import { NextResponse, type NextRequest } from "next/server";
import { describe, expect, it, vi } from "vitest";
import { ErrorCode } from "@calcom/lib/errorCodes";
@@ -19,12 +19,11 @@ vi.mock("next/server", () => ({
describe("defaultResponderForAppDir", () => {
it("should return a JSON response when handler resolves with a result", async () => {
const f = vi.fn().mockResolvedValue({ success: true });
const f = vi.fn().mockResolvedValue(NextResponse.json({ success: true }));
const req = { method: "GET", url: "/api/test" } as unknown as NextRequest;
const params = {};
const response = await defaultResponderForAppDir(f)(req, { params });
console.log(response);
const json = await response.json();
expect(response.status).toBe(200);
@@ -27,7 +27,7 @@ export const defaultResponderForAppDir = <T extends NextResponse | Response = Ne
ok = true;
if (result) {
return result instanceof Response ? result : NextResponse.json(result);
return result;
}
return NextResponse.json({});