test: comprehensive test suites and quality gates pass across backend, storefront and admin
- Backend (NestJS): 82 suites, 641 tests passing; 0 ESLint errors; 0 tsc errors. Hardened SSL cert/key matching, SSRF IP pinning, and eBank validation. - Admin Panel (Vite/React): 48 suites, 300 tests passing; 0 ESLint errors; 0 tsc errors. Full coverage across all pages and settings. - Storefront (Next.js): 62 suites, 368 tests passing; 0 ESLint errors; 0 tsc errors. - Fixed unmount lifecycle guards, promise error handling, and component edge cases.
This commit is contained in:
1 parent
1e73715169
commit
ddbf1ca026
439 files changed
+32911
-6107
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable, Logger } from "@nestjs/common";
|
||||
|
||||
@Injectable()
|
||||
export class RevalidationService {
|
||||
@@ -9,24 +9,24 @@ export class RevalidationService {
|
||||
process.env.FRONTEND_INTERNAL_URL ||
|
||||
process.env.FRONTEND_URL ||
|
||||
process.env.NEXT_PUBLIC_SITE_URL ||
|
||||
(process.env.NODE_ENV === 'production'
|
||||
? 'http://frontend_prod:8080'
|
||||
: 'http://localhost:3000');
|
||||
return raw.replace(/\/+$/, '');
|
||||
(process.env.NODE_ENV === "production"
|
||||
? "http://frontend_prod:8080"
|
||||
: "http://localhost:3000");
|
||||
return raw.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
private get secret(): string {
|
||||
const secret = process.env.REVALIDATION_SECRET;
|
||||
if (!secret) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
throw new Error(
|
||||
'REVALIDATION_SECRET is required in production environment.',
|
||||
"REVALIDATION_SECRET is required in production environment.",
|
||||
);
|
||||
}
|
||||
this.logger.warn(
|
||||
'REVALIDATION_SECRET is not defined in environment variables.',
|
||||
"REVALIDATION_SECRET is not defined in environment variables.",
|
||||
);
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
return secret;
|
||||
}
|
||||
@@ -35,10 +35,10 @@ export class RevalidationService {
|
||||
try {
|
||||
const url = `${this.frontendUrl}/api/revalidate`;
|
||||
const res = await fetch(url, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-revalidate-secret': this.secret,
|
||||
"Content-Type": "application/json",
|
||||
"x-revalidate-secret": this.secret,
|
||||
},
|
||||
body: JSON.stringify({ tag, secret: this.secret }),
|
||||
});
|
||||
@@ -64,10 +64,10 @@ export class RevalidationService {
|
||||
try {
|
||||
const url = `${this.frontendUrl}/api/revalidate`;
|
||||
const res = await fetch(url, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-revalidate-secret': this.secret,
|
||||
"Content-Type": "application/json",
|
||||
"x-revalidate-secret": this.secret,
|
||||
},
|
||||
body: JSON.stringify({ path, secret: this.secret }),
|
||||
});
|
||||
@@ -91,10 +91,10 @@ export class RevalidationService {
|
||||
|
||||
async revalidateProduct(slug?: string, artNo?: string): Promise<void> {
|
||||
const tasks: Promise<boolean>[] = [
|
||||
this.revalidateTag('products'),
|
||||
this.revalidateTag('home-data'),
|
||||
this.revalidatePath('/shop'),
|
||||
this.revalidatePath('/'),
|
||||
this.revalidateTag("products"),
|
||||
this.revalidateTag("home-data"),
|
||||
this.revalidatePath("/shop"),
|
||||
this.revalidatePath("/"),
|
||||
];
|
||||
|
||||
if (slug) {
|
||||
@@ -111,11 +111,11 @@ export class RevalidationService {
|
||||
|
||||
async revalidateBlog(slug?: string): Promise<void> {
|
||||
const tasks: Promise<boolean>[] = [
|
||||
this.revalidateTag('blogs'),
|
||||
this.revalidateTag('home-data'),
|
||||
this.revalidatePath('/blog'),
|
||||
this.revalidatePath('/sitemap.xml'),
|
||||
this.revalidatePath('/'),
|
||||
this.revalidateTag("blogs"),
|
||||
this.revalidateTag("home-data"),
|
||||
this.revalidatePath("/blog"),
|
||||
this.revalidatePath("/sitemap.xml"),
|
||||
this.revalidatePath("/"),
|
||||
];
|
||||
|
||||
if (slug) {
|
||||
@@ -128,10 +128,10 @@ export class RevalidationService {
|
||||
|
||||
async revalidateSettings(): Promise<void> {
|
||||
await Promise.allSettled([
|
||||
this.revalidateTag('settings'),
|
||||
this.revalidateTag('home-data'),
|
||||
this.revalidateTag('seo-config'),
|
||||
this.revalidatePath('/'),
|
||||
this.revalidateTag("settings"),
|
||||
this.revalidateTag("home-data"),
|
||||
this.revalidateTag("seo-config"),
|
||||
this.revalidatePath("/"),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user