mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
831c45397f
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
43 lines
997 B
TypeScript
43 lines
997 B
TypeScript
import {
|
|
Limit,
|
|
incLimitedValue,
|
|
isLimitReached,
|
|
resetAllLimits,
|
|
setMaxLimit,
|
|
} from './limits';
|
|
|
|
describe('lib/workers/global/limits', () => {
|
|
beforeEach(() => {
|
|
resetAllLimits();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
resetAllLimits();
|
|
});
|
|
|
|
it('increments limited value', () => {
|
|
setMaxLimit(Limit.Commits, 3);
|
|
|
|
expect(isLimitReached(Limit.Commits)).toBe(false);
|
|
|
|
incLimitedValue(Limit.Commits, 2);
|
|
expect(isLimitReached(Limit.Commits)).toBe(false);
|
|
|
|
incLimitedValue(Limit.Commits);
|
|
expect(isLimitReached(Limit.Commits)).toBe(true);
|
|
|
|
incLimitedValue(Limit.Commits);
|
|
expect(isLimitReached(Limit.Commits)).toBe(true);
|
|
});
|
|
|
|
it('defaults to unlimited', () => {
|
|
expect(isLimitReached(Limit.Commits)).toBe(false);
|
|
});
|
|
|
|
it('increments undefined', () => {
|
|
incLimitedValue(Limit.Commits);
|
|
expect(isLimitReached(Limit.Commits)).toBe(false);
|
|
setMaxLimit(Limit.Commits, 1);
|
|
expect(isLimitReached(Limit.Commits)).toBe(true);
|
|
});
|
|
});
|