diff --git a/packages/backend/server/tests/nestjs/throttler.spec.ts b/packages/backend/server/tests/nestjs/throttler.spec.ts index a3fad649f1..77921961f5 100644 --- a/packages/backend/server/tests/nestjs/throttler.spec.ts +++ b/packages/backend/server/tests/nestjs/throttler.spec.ts @@ -156,7 +156,7 @@ test('should use default throttler for unauthenticated user when not specified', t.is(headers.limit, '120'); t.is(headers.remaining, '119'); - t.is(headers.reset, '60'); + t.regex(headers.reset, /59|60/); }); test('should skip throttler for unauthenticated user when specified', async t => { @@ -192,7 +192,7 @@ test('should use specified throttler for unauthenticated user', async t => { t.is(headers.limit, '20'); t.is(headers.remaining, '19'); - t.is(headers.reset, '60'); + t.regex(headers.reset, /59|60/); }); // ==== authenticated user visits ==== @@ -223,7 +223,7 @@ test('should use default throttler for authenticated user when not specified', a t.is(headers.limit, '120'); t.is(headers.remaining, '119'); - t.is(headers.reset, '60'); + t.regex(headers.reset, /59|60/); }); test('should use same throttler for multiple routes', async t => { @@ -238,7 +238,7 @@ test('should use same throttler for multiple routes', async t => { t.is(headers.limit, '120'); t.is(headers.remaining, '119'); - t.is(headers.reset, '60'); + t.regex(headers.reset, /59|60/); res = await request(app.getHttpServer()) .get('/throttled/default2') @@ -263,7 +263,7 @@ test('should use different throttler if specified', async t => { t.is(headers.limit, '120'); t.is(headers.remaining, '119'); - t.is(headers.reset, '60'); + t.regex(headers.reset, /59|60/); res = await request(app.getHttpServer()) .get('/throttled/default3') @@ -274,7 +274,7 @@ test('should use different throttler if specified', async t => { t.is(headers.limit, '10'); t.is(headers.remaining, '9'); - t.is(headers.reset, '60'); + t.regex(headers.reset, /59|60/); }); test('should skip throttler for authenticated user when specified', async t => { @@ -304,7 +304,7 @@ test('should use specified throttler for authenticated user', async t => { t.is(headers.limit, '20'); t.is(headers.remaining, '19'); - t.is(headers.reset, '60'); + t.regex(headers.reset, /59|60/); }); test('should separate anonymous and authenticated user throttlers', async t => { @@ -323,9 +323,9 @@ test('should separate anonymous and authenticated user throttlers', async t => { t.is(authenticatedResHeaders.limit, '120'); t.is(authenticatedResHeaders.remaining, '119'); - t.is(authenticatedResHeaders.reset, '60'); + t.regex(authenticatedResHeaders.reset, /59|60/); t.is(unauthenticatedResHeaders.limit, '120'); t.is(unauthenticatedResHeaders.remaining, '119'); - t.is(unauthenticatedResHeaders.reset, '60'); + t.regex(unauthenticatedResHeaders.reset, /59|60/); });