Añadido Dockerfil docker-compose.yml

This commit is contained in:
2026-05-30 21:47:44 -05:00
parent 40986b0359
commit 5a563b214f
101 changed files with 10207 additions and 950 deletions
+40
View File
@@ -0,0 +1,40 @@
import { expect } from "vitest";
/**
* Helper to test Next.js App Router API routes.
* Creates a Request object and extracts the Response.
*/
export function createTestRequest(
options: {
method?: string;
url?: string;
body?: unknown;
headers?: Record<string, string>;
} = {}
): Request {
const { method = "POST", url = "http://localhost/api/test", body, headers = {} } = options;
const init: RequestInit = {
method,
headers: {
"Content-Type": "application/json",
...headers,
},
};
if (body !== undefined) {
init.body = JSON.stringify(body);
}
return new Request(url, init);
}
export async function parseJsonResponse(response: Response): Promise<unknown> {
return response.json();
}
export function expectJsonResponse(response: Response, expectedStatus: number) {
expect(response.status).toBe(expectedStatus);
expect(response.headers.get("content-type")?.toLowerCase()).toContain("application/json");
}