From 172d172e823eed224c7934f4c6cba30ea7d79c7a Mon Sep 17 00:00:00 2001 From: Sokratis Vidros Date: Fri, 4 Oct 2024 17:54:59 +0300 Subject: [PATCH] fix(api): Update .source and quota-throttler tests (#6627) --- .../app/shared/interceptors/product-feature.interceptor.ts | 1 + .../src/app/testing/billing/quota-throttler.guard.e2e-ee.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/apps/api/src/app/shared/interceptors/product-feature.interceptor.ts b/apps/api/src/app/shared/interceptors/product-feature.interceptor.ts index dd7b2b3a858..7c0d552d074 100644 --- a/apps/api/src/app/shared/interceptors/product-feature.interceptor.ts +++ b/apps/api/src/app/shared/interceptors/product-feature.interceptor.ts @@ -51,6 +51,7 @@ export class ProductFeatureInterceptor implements NestInterceptor { ); if (!enabled) { + // TODO: Reuse PaymentRequiredException from EE billing module. throw new HttpException('Payment Required', 402); } diff --git a/apps/api/src/app/testing/billing/quota-throttler.guard.e2e-ee.ts b/apps/api/src/app/testing/billing/quota-throttler.guard.e2e-ee.ts index 9cad166be09..1eb9b199ad7 100644 --- a/apps/api/src/app/testing/billing/quota-throttler.guard.e2e-ee.ts +++ b/apps/api/src/app/testing/billing/quota-throttler.guard.e2e-ee.ts @@ -51,6 +51,11 @@ describe('Resource Limiting', () => { const response = await request(pathEvent); expect(response.status).to.equal(402); + expect(response.body.status).to.equal(402); + expect(response.body.error).to.equal('Payment required'); + expect(response.body.message).to.match( + /You have exceeded the number of allowed requests for this resource\. Please visit http.+ to upgrade your subscription./ + ); }); });