feat: Landing Page and Login/Register Modal 1.01

This commit is contained in:
OpenVelo Agent
2026-07-21 21:19:36 +00:00
parent ad40b3b820
commit 5f30a125c1
5 changed files with 73 additions and 42 deletions
+20 -1
View File
@@ -32,6 +32,25 @@ describe('RegistrationRateLimitService', () => {
for (let i = 0; i < 10; i++) s.record('1.1.1.1', now + i);
expect(s.isAllowed('2.2.2.2', now + 10)).toBe(true);
});
it('tryConsume admits exactly 10 and rejects the 11th without double-recording', () => {
const s = new RegistrationRateLimitService();
const now = 1_000_000;
for (let i = 0; i < 10; i++) {
expect(s.tryConsume('1.1.1.1', now + i)).toBe(true);
}
expect(s.tryConsume('1.1.1.1', now + 10)).toBe(false);
});
it('tryConsume admits again once the window rolls over', () => {
const s = new RegistrationRateLimitService();
const base = 1_000_000;
for (let i = 0; i < 10; i++) {
expect(s.tryConsume('1.1.1.1', base + i)).toBe(true);
}
expect(s.tryConsume('1.1.1.1', base + 10)).toBe(false);
expect(s.tryConsume('1.1.1.1', base + 60_000)).toBe(true);
});
});
describe('register-first-admin registration rate limit (integration)', () => {
@@ -77,4 +96,4 @@ describe('register-first-admin registration rate limit (integration)', () => {
.send({ username: 'noone', password: 'Sup3rSecret!Pass' })
.expect(429);
});
});
});