enable rate limits for dev environment
This commit is contained in:
@@ -24,7 +24,7 @@ export class SkRateLimiterService {
|
|||||||
@Inject(EnvService)
|
@Inject(EnvService)
|
||||||
envService: EnvService,
|
envService: EnvService,
|
||||||
) {
|
) {
|
||||||
this.disabled = envService.env.NODE_ENV !== 'production';
|
this.disabled = envService.env.NODE_ENV === 'test';
|
||||||
}
|
}
|
||||||
|
|
||||||
public async limit(limit: Keyed<RateLimit>, actor: string, factor = 1): Promise<LimitInfo> {
|
public async limit(limit: Keyed<RateLimit>, actor: string, factor = 1): Promise<LimitInfo> {
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ describe(SkRateLimiterService, () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should bypass in non-production', async () => {
|
it('should bypass in test environment', async () => {
|
||||||
mockEnvironment.NODE_ENV = 'test';
|
mockEnvironment.NODE_ENV = 'test';
|
||||||
|
|
||||||
const info = await serviceUnderTest().limit({ key: 'l', type: undefined, max: 0 }, actor);
|
const info = await serviceUnderTest().limit({ key: 'l', type: undefined, max: 0 }, actor);
|
||||||
|
|||||||
Reference in New Issue
Block a user