meilleure gestion des templates d'email (allégés)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user