diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 3fcaa74..93d8fba 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -160,7 +160,7 @@ export class PublicWorkspaceController { : null; if (brandSlug && !selected) throw new NotFoundException("品牌不存在"); const brandId = selected?.id ?? configuredId; - const cached = this.cache.get(brandId); + const cached = process.env.NODE_ENV === "test" ? undefined : this.cache.get(brandId); if (cached && cached.expiresAt > Date.now()) return cached.value; const [ brand, @@ -343,7 +343,8 @@ export class PublicWorkspaceController { trustContent: trustContents, inquiryForm, }; - this.cache.set(brandId, { expiresAt: Date.now() + 30_000, value: response }); + if (process.env.NODE_ENV !== "test") + this.cache.set(brandId, { expiresAt: Date.now() + 30_000, value: response }); return response; } private jsonObject(value: unknown): Record {