meilleure gestion des templates d'email (allégés)

This commit is contained in:
Yannick Le Duc
2025-09-16 16:47:14 +02:00
parent b20c88b05d
commit 17deb72834
6 changed files with 227 additions and 19 deletions

View File

@@ -63,3 +63,34 @@ global.IntersectionObserver = jest.fn().mockImplementation(() => ({
unobserve: jest.fn(),
disconnect: jest.fn(),
}));
// Mock NextRequest and NextResponse for API routes
global.Request = global.Request || class Request {
constructor(input, init) {
this.url = typeof input === 'string' ? input : input.url;
this.method = init?.method || 'GET';
this.headers = new Map(Object.entries(init?.headers || {}));
this._body = init?.body;
}
async json() {
return JSON.parse(this._body);
}
async text() {
return this._body;
}
};
global.Response = global.Response || class Response {
constructor(body, init) {
this.body = body;
this.status = init?.status || 200;
this.statusText = init?.statusText || 'OK';
this.headers = new Map(Object.entries(init?.headers || {}));
}
async json() {
return JSON.parse(this.body);
}
};