v0.5.13: зачистка UI — мёртвый login.ejs, /exp→/export, комментарии

This commit is contained in:
2026-06-03 06:06:40 +03:00
parent ac0f151bcb
commit 3dc5dc4ecc
3 changed files with 16 additions and 100 deletions
+11 -11
View File
@@ -68,7 +68,7 @@ async function cleanupAll() {
const auth = await authMod.initAuth();
const { MOCK_USERS } = require('../src/config');
const admin = MOCK_USERS.find(u => u.id === 'admin');
const user = MOCK_USERS.find(u => u.id === 'test');
const user = MOCK_USERS.find(u => u.id === 'alfa');
const tokenAdmin = auth.issueMockToken({ clientId: admin.clientId, companyId: admin.companyId, companyName: admin.companyName, email: admin.email });
const tokenUser = auth.issueMockToken({ clientId: user.clientId, companyId: user.companyId, companyName: user.companyName, email: user.email });
@@ -771,15 +771,15 @@ async function cleanupAll() {
// ── Rate limit tests ──
// S14.1: 10 быстрых запросов к /exp (ограничен exportLimiter=20/мин)
// S14.1: 10 быстрых запросов к /export (публичный)
{
const supertest = require('supertest');
const req = supertest(app);
const results = await Promise.all(
Array(10).fill(0).map(() => req.get('/exp'))
Array(10).fill(0).map(() => req.get('/export'))
);
const all200 = results.every(r => r.status === 200);
log(all200, 'S14.1: 10× GET /exp без авторизации → все 200', results.map(r => r.status).join(','));
log(all200, 'S14.1: 10× GET /export без авторизации → все 200', results.map(r => r.status).join(','));
}
// S14.2: 10 быстрых POST /login (ограничен authLimiter)
@@ -798,22 +798,22 @@ async function cleanupAll() {
// ══════════════════════════════════════════════════════════════════════════════
console.log('\n── S15. Export edge cases ──');
// S15.1: /exp с пустой БД
// S15.1: /export с пустой БД
{
const supertest = require('supertest');
const req = supertest(app);
const r = await req.get('/exp');
log(r.status === 200, 'S15.1: /exp → 200');
log(r.headers['content-type']?.includes('text/plain'), 'S15.2: /exp Content-Type text/plain');
const r = await req.get('/export');
log(r.status === 200, 'S15.1: /export → 200');
log(r.headers['content-type']?.includes('text/plain'), 'S15.2: /export Content-Type text/plain');
}
// S15.3: /exp после добавления записи
// S15.3: /export после добавления записи
{
await q.createEntry(userCompanyId, C.A, 'export-test', 'stress@test');
const supertest = require('supertest');
const req = supertest(app);
const r = await req.get('/exp');
log(r.status === 200 && r.text.includes(cidr(C.A)), 'S15.3: /exp содержит добавленный CIDR');
const r = await req.get('/export');
log(r.status === 200 && r.text.includes(cidr(C.A)), 'S15.3: /export содержит добавленный CIDR');
await pool.query(`UPDATE whitelist_entries SET deleted_at=NOW(), deleted_by='stress' WHERE value_cidr=$1 AND deleted_at IS NULL`,
[cidr(C.A)]);
}