mirror of
https://git.boykissers.com/pawkey/pawkey-sk.git
synced 2025-12-20 12:14:18 +00:00
bypass rate limits when factor is 0
This commit is contained in:
@@ -300,10 +300,11 @@ describe(SkRateLimiterService, () => {
|
||||
expect(counter?.t).toBe(0);
|
||||
});
|
||||
|
||||
it('should throw if factor is zero', async () => {
|
||||
const promise = serviceUnderTest().limit(limit, actor, 0);
|
||||
it('should skip if factor is zero', async () => {
|
||||
const info = await serviceUnderTest().limit(limit, actor, 0);
|
||||
|
||||
await expect(promise).rejects.toThrow(/factor is zero or negative/);
|
||||
expect(info.blocked).toBeFalsy();
|
||||
expect(info.remaining).toBe(Number.MAX_SAFE_INTEGER);
|
||||
});
|
||||
|
||||
it('should throw if factor is negative', async () => {
|
||||
@@ -537,10 +538,11 @@ describe(SkRateLimiterService, () => {
|
||||
expect(minCounter?.t).toBe(0);
|
||||
});
|
||||
|
||||
it('should throw if factor is zero', async () => {
|
||||
const promise = serviceUnderTest().limit(limit, actor, 0);
|
||||
it('should skip if factor is zero', async () => {
|
||||
const info = await serviceUnderTest().limit(limit, actor, 0);
|
||||
|
||||
await expect(promise).rejects.toThrow(/factor is zero or negative/);
|
||||
expect(info.blocked).toBeFalsy();
|
||||
expect(info.remaining).toBe(Number.MAX_SAFE_INTEGER);
|
||||
});
|
||||
|
||||
it('should throw if factor is negative', async () => {
|
||||
@@ -693,10 +695,11 @@ describe(SkRateLimiterService, () => {
|
||||
expect(i2.blocked).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should throw if factor is zero', async () => {
|
||||
const promise = serviceUnderTest().limit(limit, actor, 0);
|
||||
it('should skip if factor is zero', async () => {
|
||||
const info = await serviceUnderTest().limit(limit, actor, 0);
|
||||
|
||||
await expect(promise).rejects.toThrow(/factor is zero or negative/);
|
||||
expect(info.blocked).toBeFalsy();
|
||||
expect(info.remaining).toBe(Number.MAX_SAFE_INTEGER);
|
||||
});
|
||||
|
||||
it('should throw if factor is negative', async () => {
|
||||
|
||||
Reference in New Issue
Block a user